Sunday, February 12, 2012

convert datetime to UTC seconds

Hi guys,
Do you know how to convert a datetime to UTC seconds:
eg: nov 17, 2005 21:00:00
UTC in seconds: 1132261200
thank a lot
Message posted via webservertalk.com
http://www.webservertalk.com/Uwe/Forum...amming/200511/1http://www.aspfaq.com/2451
"fasttrack via webservertalk.com" <u15121@.uwe> wrote in message
news:5783c74d47a66@.uwe...
> Hi guys,
> Do you know how to convert a datetime to UTC seconds:
> eg: nov 17, 2005 21:00:00
> UTC in seconds: 1132261200
> thank a lot
> --
> Message posted via webservertalk.com
> http://www.webservertalk.com/Uwe/Forum...amming/200511/1|||current: select datediff(second, '19700101', GetUTCDate())
given a local date:
-- use dateadd(hour, datediff(hour, GetDate(), GetUTCDate())
-- to get the current hour difference between UTC and local date
declare @.GetDateVal datetime
select @.GetDateVal = '20051117 15:00:00'
select @.GetDateVal, datediff(second, '19700101', dateadd(hour,
datediff(hour, GetDate(), GetUTCDate()), @.GetDateVal ) )
fasttrack via webservertalk.com wrote:
> Hi guys,
> Do you know how to convert a datetime to UTC seconds:
> eg: nov 17, 2005 21:00:00
> UTC in seconds: 1132261200
> thank a lot
>

No comments:

Post a Comment