Click here to Skip to main content
15,879,535 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello,
how to convert bigint to datetime in sql server i have some bigint values and their correponding datatime values but i am not able to find logic behind it..

Value(Bigint)--- Datetime
1333270800------ '2012-04-01 09:00:00.000
1333274400------ '2012-04-01 10:00:00.000'
381403800------- '1982-02-01 09:30:00.000'
1270116000------ '2012-02-26 10:00:00.000'
127013003------- '2012-04-01 10:00:00.000'



Please reply how to convert this values into datetime

Thanks
Srishti
Posted

Check the below link.

how to convert bigint to datetime in sql server[^]

Hope this link helps.
 
Share this answer
 
It seems that the number represents the second since the unix epoch (1/1/1970)...
You can get SQL datetime out of it with this command:
SQL
SELECT DATEADD(S, @your-big-int, '19700101')
 
Share this answer
 
Comments
srishti_ 29-Sep-14 8:21am    
Thanks a lot

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900