Code Bank
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsProgrammingCode Bank

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old September 29th, 2004, 07:52 AM
dbuttram dbuttram is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Sep 2004
Posts: 1 dbuttram User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Exclamation Filter Recordset convert date

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

Reply With Quote
  #2  
Old October 5th, 2004, 05:10 PM
tumi tumi is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Oct 2004
Posts: 4 tumi User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via ICQ to tumi Send a message via MSN to tumi
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

Reply With Quote
Reply

Viewing: ASP Free ForumsProgrammingCode Bank > Filter Recordset convert date


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway