jquery - converting date string to utc time format javascript -


i'm trying convert date string format "2014-12-04 12:00am" utc time format of "2014-11-29 01:00:12".

i'm using function

 function formatdate(d){           function addzero(n){               return n < 10 ? '0' + n : '' + n;           }            return d.getutcfullyear() +"-"+ addzero(d.getutcmonth()+1) + "-" +addzero(d.getutcdate()) + " " +               addzero(d.getutchours()) + ":" + addzero(d.getutcminutes()) + ":" + addzero(d.getutcminutes());       }  

for reason when pick 12am it's set val 12pm , i'm not sure function working on possibilities

try js :

var d = new date("2014-12-04 12:00 am"); var n = d.toutcstring(); alert(n); // output: wed, 03 dec 2014 18:30:00 gmt 

you can see link : http://www.w3schools.com/jsref/tryit.asp?filename=tryjsref_toutcstring


Comments

Popular posts from this blog

javascript - ScrollTo Effect (href to div) -

javascript - ng-class not responding to change in model in Angular? -

javascript - document.registerElement extending HTMLInputElement prototype while using custom tag name to avoid implicit browser style -