Hello,
Is there a better way to convert separate integer values, representing Day, Month, Year, Hour, Minute and Second to DateTime?
I work in the Automation Industry and PLC (Programmable Logic Circuits) programs often store Date/Time in this format.
The best I can work out is like this...
Declare @Day Int
Declare @Month Int
Declare @Year Int
Set @Day = 1
Set @Month = 2
Set @Year = 2007
Select DateAdd(dd, @Day-1, DateAdd(mm, @Month-1, DateAdd(yy, @Year-1900, '1900-01-01')))