Submitted by northben on Thu, 10/11/2012 - 13:11
I am in the middle of a SQL data conversion project. Amazingly, our *new* SQL Server database requires dates to be stored in Unix format, which is a bigint field with the number of milliseconds since 01/01/1970. Amazing, I tell you.
Here are some queries that I have found useful in this project. I have updated this article to include an alternative that does not involve functions.
Submitted by northben on Mon, 11/08/2010 - 15:37
Here is how to use the SQL convert function to extract just the date portion of a SQL datetime field.
convert(varchar(10), eventdate, 101)
It will result in something like this:
04/20/2010
You can change the syntax slightly if you want a different date format. Here is the full documentation on the convert function: http://msdn.microsoft.com/en-us/library/aa226054%28SQL.80%29.aspx