[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1353
  • Last Modified:

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
0
jkavx
Asked:
jkavx
1 Solution
 
Jan FranekCommented:
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

Featured Post

Prep for the ITIL® Foundation Certification Exam

December’s Course of the Month is now available! Enroll to learn ITIL® Foundation best practices for delivering IT services effectively and efficiently.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now