Date with Hawaii timezone makes invalid JavaScript date -


for reason, when pass date hawaii time zone javascript's date() "invalid date", other time zone don't. there workaround this?

var hast = 'wed, 31 jul 2013 07:21:16 hast'; var hawaiitime = new date(hast); console.log("hawaii time: "+hawaiitime); // hawaii time: invalid date  var pst = 'wed, 31 jul 2013 07:21:16 pst'; var pacifictime = new date(pst); console.log("pacific time: "+pacifictime); // pacific time: wed jul 31 2013 09:21:16 gmt-0600 (mdt)  

jsfiddle

rfc 2822 supports north american ut offsets (see page 32).

"est" / "edt" /         ; eastern:  - 5/ - 4 "cst" / "cdt" /         ; central:  - 6/ - 5 "mst" / "mdt" /         ; mountain: - 7/ - 6 "pst" / "pdt" /         ; pacific:  - 8/ - 7 

for else, should use numeric value relative utc or gmt. hast, utc-1000 (10 hours before utc):

var hast = 'wed, 31 jul 2013 07:21:16 utc-1000'; 

fiddle


Comments

Popular posts from this blog

c++ - Creating new partition disk winapi -

Android Prevent Bluetooth Pairing Dialog -

VBA function to include CDATA -