Code Snippets
Tuesday, December 2, 2008
sql: easy datetime formatting to varchar
convert(varchar, FIELD_NAME, FORMAT_NUMBER_FROM_CHART)
http://msdn.microsoft.com/en-us/library/aa226054(SQL.80).aspx
sql: get just the hour from a datetime
SELECT DATEADD(hh, 13, DATEADD(dd, 0, DATEDIFF(dd, 0, GETDATE())))
probably a fancier way to keep the hour information, but you can just in an hour variable there to add it back in.
replace getdate() with your date field
Newer Posts
Older Posts
Home
Subscribe to:
Posts (Atom)