I have a date format of yyyy-mm-dd hh:mm:ss.nnn in my sql datasource
when i look at the data in SSMS it looks fine
but when i get the return value in my C# it looks like this:
40927,7895138889
but the value in the source is:
2011-12-29 21:52:47.427
I haven’t seen this before, can anyone advise on what might be happening?
thanks.
edit: i am returning this value from sql server 2005 to my asp.net mvc 1.0 nerddinner tutorial site
Dates are stored as numbers in SQL, x days past some starting date (I think in 1753). Somehow, it looks like you are storing the returned date value in a float field. Try adding your 40927 to 1/1/1753 (40,927 days past January 1, 1753) and see if you get the right value
Try this SQL command
it will return 0, indicating Jan 1, 1900 is the first date. I suspect the field type is smalldatetime which stores dates and times of day with less precision than datetime datatype. Valid date range for this data type is from January 1, 1900 through June 6, 2079.
The number represents number of day past Jan 1, 1900. The fractional part is the time portion. Try this: