| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
We have a database that stores employees birthdays as month and day (mm/dd) but in text format. When I load a page I need to list all of the people with a birthday today so I need to do a conversion in the sql call to convert the system month and day to text so I can compare. Any help would be appreciated.
Dave |
|
#2
|
|||
|
|||
|
Depending if you are using MS SQL or MS Access you can use various ways.
This one is for MS SQL: sMonth = Month(Now()) sDay = Day(Now()) Then you pass this in you Where clasuse of the query (... WHERE (DATEPART(Month, employees.birthdate) = " & sAge & ") AND (DATEPART(Day, employees.birthdate) = " & sAge & ")" For Access I suggest you do the check in your while/wend and response only those that are from today ... While (NOT rs_SelectBirthdays.EOF)) If Month(Cdate(rs_SelectBirthdays("birthdate")))=sMonth AND Day(Cdate(rs_SelectBirthdays("birthdate"))) = sDay THEN Response.Write... rs_SelectBirthdays.MoveNext() Wend hope this help you thanks |
![]() |
| Viewing: ASP Free Forums > Programming > Code Bank > Filter Recordset convert date |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|