简体   繁体   中英

How to convert UTC datetime to different format

I have a datetime string in the following format.

var datetime="Thu May 5 05:30:00 UTC+0530 2011" ;

I want to convert it in the following format. How can I do it in javascript

"Thursday, 05 May 2011"

The globalize plugin has date parsing and formatting features.

Here is an example from the plugin page:

Globalize.format( new Date(1955,10,5), "dddd MMMM d, yyyy" ); // "Saturday November 5, 1955"

The date.js library is very useful for working with Dates.

Formatting examples:

Date.today().toString("dddd MMMM d, yyyy"); // Monday November 19, 2007
Date.today().toString();                    // native .toString() functionality
Date.today().toString("M/d/yyyy");          // 11/19/2007
Date.today().toString("d-MMM-yyyy");        // 19-Nov-2007
new Date().toString("HH:mm");               // 18:45

Parsing examples:

Date.parse('today');
Date.parse('t + 5 d'); // today + 5 days
Date.parse('next thursday');
Date.parse('February 20th 1973');
Date.parse('Thu, 1 July 2004 22:30:00');

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM