One day less JavaScript time conversion problem

Source: Internet
Author: User
First, new date ("2011-12-31 ");

The output is

Date { Fri Dec 30 2011 18:00:00 GMT-0600 (CST) }

This may be related to your operating system time zone and the browser.

New date ("2011-12-31"). tostring ();

The output is

"Fri Dec 30 2011 18:00:00 GMT-0600 (CST )"

Is there a normal output time?

New date ("2011-12-31"). toutcstring ();

The output is

"SAT, 31 Dec 2011 00:00:00 GMT"

Approaching, and then approaching

New date ("2011-12-31"). toutcstring (). substring (5, 16 );

The output is

& Quot; 31 Dec 2011 & quot"

A comma is missing,

New date ("2011-12-31 "). toutcstring (). substring (5, 11 ). concat (","). concat (new date ("2011-12-31 "). toutcstring (). substring (11,16 ));

The output is

"31 Dec, 2011"

 

OK, perfect!

 

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.