Click to See Complete Forum and Search --> : Dates - varchar to a date format


sqlclueless
08-06-2008, 06:12 PM
Hi

I have a varchar field that contains a date entry and sometimes has a time. such as:
01-August-2008 10:00am
or just
21-December-2007

I need these to be converted into a date format so that i can add them to my where clause to say show me the record where the date is within the next 2 days. (i dont actually care about the time and i could get rid of the time before its used in the field if that makes it easier)

Please help.

legendx
08-07-2008, 09:01 AM
CAST('myField' as date) and cross your fingers

chazzy
08-07-2008, 11:57 AM
you need to tell us what DBMS you're using.

sqlclueless
08-07-2008, 01:57 PM
My database is sql server 2000

ta