October 21, 2010 at 9:47 am
I need to convert an int to a datetime. Examples of the values currently stored can be found below. The format from the application is yyyy/mm/dd hh:mm:ss. There doesn't appear to be a default time style associated with the format from Books Online. I've tried to specify a custom format. How can I convert the values to a datetime format? I've tried using the convert and cast functions in different ways with no success. I always get this error, "Arithmetic overflow error converting expression to data type datetime.", regardless of the method used.
1283419419
1283423562
October 21, 2010 at 10:05 am
There is no answer without knowing what that integer actually represents.
Many UNIX systems represent dates with integer values that are offsets in seconds or milliseconds from 1970-01-01 00:00:00. It's possible that's what your integers represent.
select DT = dateadd(ss,1283419419,'19700101')
Result:
DT
-----------------------
2010-09-02 09:23:39.000
Viewing 2 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply