<!DOCTYPE HTML><HTML><Head> <Script> functionmyFunction () {varb=FormatDate (636371998735052582); document.write (b); } //format Time functionFormatDate (ticks) {//var ticks = 635556672000000000; //ticks is in nanotime; Convert to Microtime varTickstomicrotime=Ticks/ 10000; //ticks is recorded from 1/1/1, get microtime difference from 1/1/1/to 1/1/1970 varEpochmicrotimediff=Math.Abs (NewDate (0, 0, 1). setFullYear (1)); //new date is ticks, converted to microtime, minus difference from epoch Microtime var Now= NewDate (Tickstomicrotime-Epochmicrotimediff); var Year=now.getfullyear (); varMonth=Now.getmonth ()+ 1; varDate=now.getdate (); varHour=now.gethours (); varminute=now.getminutes (); varSecond=now.getseconds (); return Year+ "-" +Month+ "-" +Date+ " " +Hour+ ":" +minute+ ":" +second; } </Script></Head><Body> <Buttononclick= "myFunction ()">Click here</Button></Body></HTML>
Showing results 2017-8-1 15:57:53
Convert-csharp-datetime-ticks-to-js