date - Prevent JavaScript from changing the time to GMT -


the following outputs time 4 hours less input:

x = new date('2015-07-09t14:18:12.430')  $('body').append(x)
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>

when no specify timezone:

ecmascript-5 compliant browsers assume utc timezone:

the value of absent time zone offset "z".

ecmascript-6 compliant browsers assume local timezone:

if time zone offset absent, date-time interpreted local time.


use long date constructor assumes local timezone:

var x = new date(2015, 7 - 1, 9, 14, 18, 12, 430);  alert(x);


Comments