Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

anyone know what function to use in 1

Status
Not open for further replies.

redlam

MIS
Jun 28, 2000
218
US
anyone know if there is a function in SQL2000 to convert a
javascript timestamp into a real-date format? the javascript timestamp is stored in a numeric field of length 9 (here is how it looks: 989363130671) and it represents the number of milliseconds in Universal Coordinated Time between the specified date and midnight January 1, 1970.
 
here's a user function that would do this if anyone ever needs it...
create function javatime
(@timestamp bigint, @timezoneoffset int)
returns datetime
as
begin
declare @seconds int
declare @newdate datetime
declare @newtimezone datetime
select @seconds = @timestamp/1000
select @newdate = dateadd(ss,@seconds,'01/01/1970')
select @newtimezone = dateadd(hh, -1 * @timezoneoffset, @newdate)
return @newtimezone
end
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top