Re: Adjusting for Timezone
Available news archives: comp.lang.tcl - comp.lang.python - comp.security.firewalls - sci.crypt - comp.lang.php - comp.lang.javascript
Google
 
Web news.hping.org


comp.lang.javascript archive

Re: Adjusting for Timezone

From: Dr John Stockton <jrs@merlyn.demon.co.uk>
Date: Wed Aug 31 2005 - 16:24:21 CEST

JRS: In article <+nnDl3BhTOFDFwaN@merlyn.demon.co.uk>, dated Tue, 30
Aug 2005 23:59:45, seen in news:comp.lang.javascript, Dr John Stockton
<jrs@merlyn.demon.co.uk> posted :
> ...
Update : omit "maybe", and in the same line "not" -> "now".

function TryISO(F) { var OK, S
  S = F.ISO.value
  OK = /^(\d{4})?-?(\d\d)?-?(\d\d)?T?(\d\d)?:?(\d\d)?:?(\d\d)?([+-])?(\d\d)?:?(\d\d)?$/.test(S)
  with (RegExp) F.DT.value = !OK ? "BAD" : new Date(Date.UTC(
    $1||77, $2-1, $3, $4 - ($7+$8), $5 - ($7+$9)||0, $6
    )).UTCstr() }

F is a form. Those who don't have .UTCstr() can omit it. 77 is arbitrary!

One day, I may learn what's preferred to such use of $1..$9.
 

-- 
 © 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.htm> jscr maths, dates, sources.
 <URL:http://www.merlyn.demon.co.uk/> TP/BP/Delphi/jscr/&c, FAQ items, links.
Received on Tue Oct 18 03:15:12 2005