How to format a timestamp in android Webview using javascript -
I want to format a timestamp such as 1406270888 on Sunday, July 25, 2014 at 12:48:08 PM A WebView Android device
My JavaScript code is as follows:
& lt; Script & gt; Var chatTimestamp = parseInt (1406270888); Var date = new date (chattimestamp * 1000); Var LocalTime = Date.TolokelDetting () + "+ + date. Tolokel Timestrying (); Document.getElementById ("Demo"). InnerHTML = Local Time; & Lt; / Script & gt; But the output I get is as follows:
Sunday, July 25, 2014 12:48:08
So basically AM is PM
Source:
Any help is appreciated.
Thank you
Try this script
< Code> & lt; Script type = "text / javascript" & gt; Var chatTimestamp = parseInt (1406270888); Var date = new date (chattimestamp * 1000); Document.write (date.toString ()); Dokyumentkwrite (Detkgetfullyear) + '-' + Detkgetmonth () + '-' + Detkgetdte () + '' + Detkgethors () + ':' + Detkgetminutes () + ': '+ Date.getSeconds ()); & Lt; / Script & gt;
Comments
Post a Comment