Convert JSON format date (in milliseconds) to daily date format and daily format time comparison

Source: Internet
Author: User

The first: is to convert the time generated in JSON format to the format of the time to see clearly
function (Cellval) {
var date = new Date (parseint ("Cellval.replace" ("/date", "" "). Replace (")/"," "), 10));
var month = Date.getmonth () + 1 < 10? "0" + (date.getmonth () + 1): Date.getmonth () + 1;
var currentdate = date.getdate () < 10? "0" + date.getdate (): Date.getdate ();
var hour = date.gethours () < 10? "0" + date.gethours (): Date.gethours ();
var minute = Date.getminutes () < 10? "0" + date.getminutes (): Date.getminutes ();
var second = Date.getseconds () < 10? "0" + date.getseconds (): Date.getseconds ();
return date.getfullyear () + "/" + month + "/" + currentdate + "" + Hour + ":" + Minute + ":" + second;
}


* Description: Cellval is the value to be converted, and time is converted in JSON format

Second: Use JS to get time daily

var today = new Date ();//Create Time Object

var nowday = today.getfullyear () + "/" + (Today.getmonth () + 1) + "/" + today.getdate () + "" + today.gethours () + ":" + t Oday.getminutes () + ":" + today.getseconds ();

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.