[Test Tool] a tool that converts Unix time to general time. The test tool is unix.

Source: Internet
Author: User

[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 ();}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.