Jqurey converts a JS method into a date, as in 2017-5-30, into a timestamp or timestamp

Source: Internet
Author: User

<script>
function Datetime_to_unix (datetime) {
var tmp_datetime = datetime.replace (/:/g, '-');
Tmp_datetime = tmp_datetime.replace (//g, '-');
var arr = tmp_datetime.split ("-");
var now = new Date (DATE.UTC (arr[0],arr[1]-1,arr[2],arr[3]-8,arr[4],arr[5));
Return parseint (Now.gettime ()/1000);
}

function Unix_to_datetime (Unix) {
var now = new Date (parseint (Unix) * 1000);
Return now.tolocalestring (). Replace (/year | month/g, "-"). Replace (/day/g, "");
}

</script>

This article from "Mountain" blog, declined reprint!

Jqurey Converts a JS method such as 2017-5-30 into a timestamp or timestamp to a date

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.