January 21, 2020 at 12:32 pm
Hi,
I have a table with one of the column [last seen] nvarchar datatype and data imported from .csv file. Data in the [last seen] column is in Unix Timestamp in MilliSecs format [1575944000000]
I need to convert it from unix timestamp to datetime format.
Tried changing the datatype of the column from nvarchar to datetime and getting below error:
- Unable to modify table. Conversion failed when converting date and/or time from character string.
Can someone please give an idea\solution to fix this issue. Thanks in advance.
January 21, 2020 at 2:08 pm
SELECT DATEADD(SECOND,1575944000000/1000,'1970-01-01 00:00:00.000')
Does this work?
How to post a question to get the most help http://www.sqlservercentral.com/articles/Best+Practices/61537
Viewing 2 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply
This website stores cookies on your computer.
These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media.
To find out more about the cookies we use, see our Privacy Policy