Its SQL Server 2000. I am starting with a character string in the format DD/MM/YYYY
+3
A:
Here's the table: http://msdn.microsoft.com/en-us/library/ms187928.aspx
Sample:
select convert(datetime,'22/03/2005', 103)
Michael Buen
2010-07-09 09:32:33
perfect, thanks
cindi
2010-07-09 09:53:17
A:
It depends your the context.
SQL Server understands '2010-06-21' as a date without requiring any convert/cast, so I would just use the string in the format 'yyyy-mm-dd' if that suits your needs.
Otherwise, the other responses using cast may be better if you need to compare with date fields containing hours as well.
iDevlop
2010-07-09 09:43:48
You'd use yyyymmdd. 2010-06-21 is *not* safe if you have say british language settings
gbn
2010-07-09 09:51:50