Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Parse date string in RFC 2822 format (as found in HTTP header field `last-modified`)

I'm using Node.js . In a HTTP response header is a field last-modified with a string representing a date and time according to RFC 2822

 'last-modified': 'Tue, 27 Dec 2011 02:12:35 GMT',

How do I convert this to a Javascript Date object?

like image 765
Colonel Panic Avatar asked Dec 27 '11 16:12

Colonel Panic


1 Answers

What's wrong with the JS Date methods?

new Date( 'Tue, 27 Dec 2011 02:12:35 GMT' )
like image 184
Nobody Avatar answered Oct 12 '22 16:10

Nobody