I need to parse dates in JavaScript. The format is
[2 digits day]/[2 digits month]/[4 digits year] [2 digits hour (24 mode)]:[2 digits minute]
For example, 16/02/2013 21:00
But if I do new Date('16/02/2013 21:00').toString()
, it gives 'Wed Apr 02 2014 21:00:00 GMT+0200 (Hora de verano romance)'
.
I guess that's because my dates don't follow IETF RFC 2822 Date and Time Specification. Then, I should convert my string, and I want to convert it to the most similar compliant format (because it should be easier to convert). But https://www.rfc-editor.org/rfc/rfc2822#page-14 is hard to understand, so I don't know which is the most similar format.
Is there a list with examples of the allowed formats?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…