SQLTeam.com | Weblogs | Forums

Date to BigInt

Dear All,

The data is stored in the table with BIGINT format ("1568235599000"). i have to pass the data in DATE ("2019-09-01") format,

select createddate from workorder where createddate in ("1568235599000")
result - 1568235599000

Thanks in Advance

Hello
What is your question?

i want to convert the BIGINT to date format

i have the data stored in BIGINT format, so i want to fetch the data based on DATE format.

Thanks for the reply,
I was looking to for giving date as input and getting the result as BIGINT.

maybe this? test it well with lots of sample data


SELECT cast(DATEDIFF(s, '19700101', 
cast('2019-09-11 13:59:59.000' as datetime)) as bigint) * 1000

Please see the below links ... they will show how to do it with examples

https://social.msdn.microsoft.com/Forums/SECURITY/en-US/b8df4689-8e10-4506-9d4c-6615892c8997/convert-date-to-bigint-sql-server-2014?forum=transactsql