473,320 Members | 1,896 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

ASP Dates Display

Hi All

I have a tricky question wonder if anyone can help.

I store dates in my table as

FDate TDate NoDays
Where Fdate is From Date
TDate is To Date
NoDays is number of days.

We use this to record holidays for our employees.

I would like to write a SQL query which will display all the records where
Fdate or Tdate are within the current month. Not very good at writing SQL
hence need some help.

Some sample data can be like this

Fdate TDate NoDays
15/05/04 18/5/04 4
29/04/04 2/5/04 5
29/5/04 3/06/04 4

If that was the data in the my table and running this query I would expect
it include all the three records when searching for month of "May" as all
three records have atleast one day which falls in the month of May

thanks for your help

Jas
Jul 19 '05 #1
5 1942
Assuming use of an Access database something like this SQL string should
work to get all the FDate's and TDate's within the current month:

strSQL = "SELECT * FROM MyTable WHERE (FDate >= #" &
DateSerial(Year(Date()), Month(Date(), 1) & "#) AND (FDate < #" &
DateSerial(Year(Date()), Month(Date() + 1, 1) & "#) AND (TDate >= #" &
DateSerial(Year(Date()), Month(Date(), 1) & "#) AND (TDate < #" &
DateSerial(Year(Date()), Month(Date() + 1, 1) & "#)"

Best regards,
J. Paul Schmidt, Freelance ASP Web Designer
http://www.Bullschmidt.com
ASP Designer Tips, ASP Web Database Demo, Free ASP Bar Chart Tool...
*** Sent via Devdex http://www.devdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 19 '05 #2
select * from table where month(FDate) = month(getdate()) or month(TDate) =
month(getdate())
Jul 19 '05 #3
Hi

Use this query

Select * from <your table>
Where Month(TDate)=5 and Month(FDate)=5

Regards
Rags
-----Original Message-----
Hi All

I have a tricky question wonder if anyone can help.

I store dates in my table as

FDate TDate NoDays
Where Fdate is From Date
TDate is To Date
NoDays is number of days.

We use this to record holidays for our employees.

I would like to write a SQL query which will display all the records whereFdate or Tdate are within the current month. Not very good at writing SQLhence need some help.

Some sample data can be like this

Fdate TDate NoDays
15/05/04 18/5/04 4
29/04/04 2/5/04 5
29/5/04 3/06/04 4

If that was the data in the my table and running this query I would expectit include all the three records when searching for month of "May" as allthree records have atleast one day which falls in the month of May
thanks for your help

Jas
.

Jul 19 '05 #4
SQL Server, Access, FoxPro, Sybase, Oracle, DB2, MySQL, Firebird, ...?

Preferably you can do this in the database without worrying about silly date
formatting within ASP. However, the database vendor, product and version
will be useful information in providing an answer.

--
http://www.aspfaq.com/
(Reverse address to reply.)


"JP SIngh" <no**@none.com> wrote in message
news:#H*************@TK2MSFTNGP09.phx.gbl...
Hi All

I have a tricky question wonder if anyone can help.

I store dates in my table as

FDate TDate NoDays
Where Fdate is From Date
TDate is To Date
NoDays is number of days.

We use this to record holidays for our employees.

I would like to write a SQL query which will display all the records where
Fdate or Tdate are within the current month. Not very good at writing SQL
hence need some help.

Some sample data can be like this

Fdate TDate NoDays
15/05/04 18/5/04 4
29/04/04 2/5/04 5
29/5/04 3/06/04 4

If that was the data in the my table and running this query I would expect
it include all the three records when searching for month of "May" as all
three records have atleast one day which falls in the month of May

thanks for your help

Jas

Jul 19 '05 #5
Using Access 2000

thanks
"Aaron [SQL Server MVP]" <te*****@dnartreb.noraa> wrote in message
news:eP**************@TK2MSFTNGP09.phx.gbl...
SQL Server, Access, FoxPro, Sybase, Oracle, DB2, MySQL, Firebird, ...?

Preferably you can do this in the database without worrying about silly date formatting within ASP. However, the database vendor, product and version
will be useful information in providing an answer.

--
http://www.aspfaq.com/
(Reverse address to reply.)


"JP SIngh" <no**@none.com> wrote in message
news:#H*************@TK2MSFTNGP09.phx.gbl...
Hi All

I have a tricky question wonder if anyone can help.

I store dates in my table as

FDate TDate NoDays
Where Fdate is From Date
TDate is To Date
NoDays is number of days.

We use this to record holidays for our employees.

I would like to write a SQL query which will display all the records where Fdate or Tdate are within the current month. Not very good at writing SQL hence need some help.

Some sample data can be like this

Fdate TDate NoDays
15/05/04 18/5/04 4
29/04/04 2/5/04 5
29/5/04 3/06/04 4

If that was the data in the my table and running this query I would expect it include all the three records when searching for month of "May" as all three records have atleast one day which falls in the month of May

thanks for your help

Jas


Jul 19 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: netsurfer | last post by:
Hi: Have a question on making the date automatically filled in by what the user enters in by the date at the top. The date entered at the top would most likely be on a Wednesday then I need...
2
by: Rachel Suddeth | last post by:
Is there a way to have the non-selectable dates (those before MinDate and after MaxDate) draw differently so my users can see right away what dates aren't allowed? I'm not seeing it... ...
1
by: David Lozzi | last post by:
Howdy, Users can specify a date in a field labeled dtDate. This field in SQL is a smalldatetime. When I vew the raw data in the table, it displays 9/29/2008, and when a user doesn't specify a...
12
by: Dixie | last post by:
I am trying to calculate the number of workdays between two dates with regards to holidays as well. I have used Arvin Meyer's code on the Access Web, but as I am in Australia and my date format is...
9
by: Greg | last post by:
Hi, I have a table with "dates", i'd like to display those dates on a calendar. I've put a calendar in a form, linked to my "date" field, and it works, but only showing one "date" per calendar....
7
by: evilcowstare via AccessMonster.com | last post by:
Hi, I have searched the forum for answers on this and to be honest as a novice I find it a bit confusing so apologies if it is simple. There are some searches that I want to apply to my database....
2
by: jai80 | last post by:
hi frenz, I want to display all the dates and day of the given year and month. For ex; if i choose 2007 and select the month January, i want to generate all the dates for this selection ...
0
by: ramesh.nrk | last post by:
Hi, In my windows application I need to display MonthCalendar control with some selected dates. I am using the property "Bolded Dates" to add selected/some dates. But those dates are displayed in...
2
by: pointers | last post by:
Hi, Can we get a SQL query, to display all the dates between two given dates eg. if date1=21-mar-2007 and date2=25-mar-2007 then the query should display all the dates between those two given...
8
JustRun
by: JustRun | last post by:
Hi, My problem is: I want to display employees tasks which recorded during two given dates I do this: select all dates based on employee ID, and place bind those dates to TWO dropdownlist...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.