Connecting Tech Pros Worldwide Help | Site Map

Converting DD/MM/YYYY date format to UTC

Matt Gyton
Guest
 
Posts: n/a
#1: Aug 17 '06
Can anyone help me, I need a way to convert a date in DD/MM/YYYY format
(the time is also present but that's not too important in this case....)
into a UTC integer using ASP/VBScript....for example:

The date 01/01/2006 would be converted to 1136073600

I need a formula to do this for me in ASP/VBScript.....Thanks!!



*** Sent via Developersdex http://www.developersdex.com ***
Dr John Stockton
Guest
 
Posts: n/a
#2: Aug 17 '06

re: Converting DD/MM/YYYY date format to UTC


JRS: In article <44e4a635$0$34072$815e3792@news.qwest.net>, dated Thu,
17 Aug 2006 17:24:05 remote, seen in news:comp.lang.javascript, Matt
Gyton <matt.gyton@ntlworld.composted :
Quote:
>Can anyone help me, I need a way to convert a date in DD/MM/YYYY format
>(the time is also present but that's not too important in this case....)
>into a UTC integer using ASP/VBScript....for example:
>
>The date 01/01/2006 would be converted to 1136073600
>
>I need a formula to do this for me in ASP/VBScript.....Thanks!!

Then posting in a Javascript group seems rather a Merkin thing to do.

A local date can only be converted into UTC if the offset from Greenwich
is known. You can only get UTC if you have a list of Leap Seconds; you
can however get UT, a modernised form of GMT.

You should have explained that 1136073600 is a count of seconds from
1970.0.

Split it into DD MM & YYYY (DD/MM/YYYY will be read as FFF for DD<13),
apply to DateSerial, subtract the corresponding value for 1970.0, and
multiply by 864e2.

In Javascript, you could just use Date.UTC(Y, M-1, D)/1000

Read the newsgroup and its FAQ.
--
© John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v4.00 IE 4 ©
<URL:http://www.jibbering.com/faq/>? JL/RC: FAQ of news:comp.lang.javascript
<URL:http://www.merlyn.demon.co.uk/js-index.htmjscr maths, dates, sources.
<URL:http://www.merlyn.demon.co.uk/TP/BP/Delphi/jscr/&c, FAQ items, links.
Closed Thread


Similar JavaScript / Ajax / DHTML bytes