哪种日期格式符合IETF标准的RFC 2822时间戳?

Ori*_*iol 13 javascript datetime date rfc rfc2822

我需要在JavaScript中解析日期.格式是

[2位数日]/[2位数月份]/[4位数年份] [2位数小时(24位模式)]:[2位数分钟]

例如, 16/02/2013 21:00

但如果我这样做new Date('16/02/2013 21:00').toString(),它会给出'Wed Apr 02 2014 21:00:00 GMT+0200 (Hora de verano romance)'.

我想这是因为我的日期不遵循IETF RFC 2822日期和时间规范.然后,我应该转换我的字符串,我想将其转换为最相似的兼容格式(因为它应该更容易转换).但http://tools.ietf.org/html/rfc2822#page-14很难理解,所以我不知道哪种格式最相似.

是否有包含允许格式示例的列表?

Pau*_*tte 15

MSDN有几个有效日期格式的示例:

document.writeln((new Date("2010")).toUTCString()); 

document.writeln((new Date("2010-06")).toUTCString());

document.writeln((new Date("2010-06-09")).toUTCString());

 // Specifies Z, which indicates UTC time.
document.writeln((new Date("2010-06-09T15:20:00Z")).toUTCString());

 // Specifies -07:00 offset, which is equivalent to Pacific Daylight time.
document.writeln((new Date("2010-06-09T15:20:00-07:00")).toGMTString());

// Specifies a non-ISO Long date.
document.writeln((new Date("June 9, 2010")).toUTCString());

// Specifies a non-ISO Long date.
document.writeln((new Date("2010 June 9")).toUTCString());

// Specifies a non-ISO Short date and time.
document.writeln((new Date("6/9/2010 3:20 pm")).toUTCString());

// Output:
// Fri, 1 Jan 2010 00:00:00 UTC
// Tue, 1 Jun 2010 00:00:00 UTC
// Wed, 9 Jun 2010 00:00:00 UTC
// Wed, 9 Jun 2010 15:20:00 UTC
// Wed, 9 Jun 2010 22:20:00 UTC
// Wed, 9 Jun 2010 07:00:00 UTC
// Wed, 9 Jun 2010 07:00:00 UTC
// Wed, 9 Jun 2010 22:20:00 UTC
Run Code Online (Sandbox Code Playgroud)

陷阱

还有一个跨浏览器不一致的矩阵.

参考