[Test Tool] a tool that converts Unix time to general time. The test tool is unix.
A tool for converting Unix time to general time
Demo effect:
Click convert:
Source code:
Function calctime2 () {var time = invalid argument Doc ument. getElementById ("inpTime "). value; if (time = "") {alert ("time is blank, enter"); return;} if (isDigit (time) = false) {alert ("time can only consist of numbers"); return;} document. write (millisecondsStrToDate (time * 1000);} function isDigit (s) {var patrn =/^ [0-9] {1, 20} $/; if (! Patrn.exe c (s) return false return true} function millisecondsStrToDate (str) {var startyear = 1970; var startmonth = 1; var startday = 1; var d, s; var sep = ":"; d = new Date (); d. setFullYear (startyear, startmonth, startday); d. setTime (0); d. setMilliseconds (str); s = d. getYear () + "-" + (d. getMonth () + 1) + "-" + d. getDate () + "" + d. getHours () + ":" + d. getMinutes () + ":" + d. getSeconds (); // alert (d. toLocaleString (); return d. toLocaleString ();}