Need to convert this timestamp (001281379300724) to YYYY-MM-DD hh:mm:ss format in SQL Server, if possible. Any suggestions?
Need to convert this timestamp (001281379300724) to YYYY-MM-DD hh:mm:ss format in SQL Server, if
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
This presumes the timestamp is ms since UNIX epoch. It only converts to the nearest second, but you could add ms to it(see below). It has to use two steps since dateadd requires an int. First add minutes by dividing by 60000, then add seconds.
Gives
To get ms precision: (yuck, probably a better way)
Gives