An integer representing a DATETIME value: how to convert?

I have a whole field containing a DATETIME value, how to convert the date and time format.

value representing date and time

6843438 is a 04/01/2013 09:18 6843660 is a 04/01/2013 13:00 

try

 select dateadd(hour,6843438,'19700101') -->> error select dateadd(hour,843438,'19700101') -->> 2066-03-21 06:00:00.000 is bad 

any idea?

+4
source share
1 answer

Well, this is not a watch because you get 09:18. So probably minutes.

We can verify that in this way, and also work with about the years

 SELECT 6843438 /60 /24 /365, --years = 13 6843438 /60, --hours = 114957 (not really useful) 6843438 % 60 --minutes = 18 

So, if you change the era before January 01, 2000, it works

 select dateadd(minute,6843438,'20000101'), dateadd(minute,6843660,'20000101') 
+5
source

Source: https://habr.com/ru/post/1440307/


All Articles