SQL Nominal Date Conversion
I currently have a table with the two columns, one 开发者_如何学Cfor Date
, and one for Datetime
.
These are stored as nominal values, and is defined as the number of days since 12/30/1899, i.e. NOM_DATE 0 = 12/30/1899
. Moment is defined as the number of minutes since 12/30/1899 12:00am (GMT), i.e. MOMENT 0 = 12/30/1899 12:00am
.
My question is how would I go ahead and convert these into actual dates like dd/mm/yy, using a stored procedure?
Something like this should be standard
DATEADD(minute, Moment, DATEADD(days, NOM_DATE , '18991230'))
This assume Moment
is for intraday (relative) only (that is, at most 1439).
Edit, after comment
If it is 2 separate columns to be converted (is it NOM_DATE
?)
DATEADD(minute, Moment, '18991230')
DATEADD(days, NOM_DATE, '18991230')
精彩评论