There are various logics to convert bigint data type to datetime.
I use different logic based on each data extraction
I use different logic based on each data extraction
- YYYYMMDDHRMISS -
MAX(DATEADD(MS, "wsfields"."UDF_DATE1" / 86400000, ("wsfields"."UDF_DATE1" / 86400000) + 25567)) AS "Lease End Date".
- Return date part as Seconds -
DATEADD(SECOND, CIH.OPERATIONTIME /1000 , '19700101 00:00')
- YYYYMMDD-
Dateadd(second,("chdt"."createdtime"+39600000)/1000,'19700101')AS"Created DATE TIME"
- Note dateadd takes 3 arguments (datepart , number , date)
- I used datepart == Second. The part of date to which DATEADD adds an integer number.
- Used Number ==
("chdt"."createdtime" + 39600000 ) / 1000
- Passed the date column, added offset value 39600000 to it. Finally divided it by 1000 to get the time zone GMT+11.
- What is offset value 39600000?
- You can calculate offset using - z x 60 x 60 x 1000. Where z is the number of hours your time zone is ahead of GMT.
- First 60 is for the hours, second 60 is for the minutes.
- In my case it was GMT+11, so i used the formula 11*60*60*1000 == 39600000
- Used date == '19700101'
- This gave the outcome as -
2020-02-27 15:15:01.000
No comments:
Post a Comment