Convert datetime to serial value


Is there any way in Sybase to convert a datetime to a numeric representation of that datetime as a serial value (milliseconds since 1/1/1970).  I have stored proc that has an output parameter that is a numeric type.  The proc creates a new record and the output param is the key of the created record.  In a certain condition, I need the output param to be a date.  This can be done by having the output parm be varchar, and doing a little work on the Java side.  But it would be cleaner in Java to continue to use the numeric output param.

Thx.

jkavx
jkavxAsked:
Who is Participating?
 
Jan FranekConnect With a Mentor Commented:
select @serialvalue = datepart(ms, @datevalue) + 1000 * datepart( second, @datevalue ) + 60000 * datepart( minute, @datevalue ) + 3600000 * datepart( hour, @datevalue ) * 86400000 * datediff( day, '1970/1/1', @datevalue )
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.