etrader Posted February 9, 2011 Share Posted February 9, 2011 How to change the date in format of ISO-8601 (example: 2005-08-15T15:52:01+0000) to RFC 822 (example: Mon, 15 Aug 05 15:52:01 +0000)? Link to comment https://forums.phpfreaks.com/topic/227219-changing-date-to-rfc822-format/ Share on other sites More sharing options...
MadTechie Posted February 9, 2011 Share Posted February 9, 2011 ISO-8601 is support and so is 822 so this should work $ISO8601 = "2005-08-15T15:52:01+0000"; //DATE_ISO8601 echo date(DATE_RFC822,strtotime($ISO8601)); Link to comment https://forums.phpfreaks.com/topic/227219-changing-date-to-rfc822-format/#findComment-1172074 Share on other sites More sharing options...
etrader Posted February 10, 2011 Author Share Posted February 10, 2011 sounds good , but it shows two-digit year instead of four-digit: 11 instead of 2011. Link to comment https://forums.phpfreaks.com/topic/227219-changing-date-to-rfc822-format/#findComment-1172093 Share on other sites More sharing options...
BlueSkyIS Posted February 10, 2011 Share Posted February 10, 2011 How to change the date in format ... to RFC 822 (example: Mon, 15 Aug 05 15:52:01 +0000)? ^ 2 digit year, no? Link to comment https://forums.phpfreaks.com/topic/227219-changing-date-to-rfc822-format/#findComment-1172103 Share on other sites More sharing options...
etrader Posted February 10, 2011 Author Share Posted February 10, 2011 Yes! As I run the above-mentioned code, it produces Mon, 15 Aug 05 15:52:01 +0000 Link to comment https://forums.phpfreaks.com/topic/227219-changing-date-to-rfc822-format/#findComment-1172104 Share on other sites More sharing options...
MadTechie Posted February 10, 2011 Share Posted February 10, 2011 As I run the above-mentioned code, it produces Mon, 15 Aug 05 15:52:01 +0000 that's what you wanted right ? Link to comment https://forums.phpfreaks.com/topic/227219-changing-date-to-rfc822-format/#findComment-1172115 Share on other sites More sharing options...
etrader Posted February 10, 2011 Author Share Posted February 10, 2011 I prefer to have four-digit year as Mon, 15 Aug 2005 15:52:01 +0000 Link to comment https://forums.phpfreaks.com/topic/227219-changing-date-to-rfc822-format/#findComment-1172117 Share on other sites More sharing options...
MadTechie Posted February 10, 2011 Share Posted February 10, 2011 So this then echo date('D, d M Y G:i:s O',strtotime($ISO8601)); Mon, 15 Aug 2005 15:52:01 +0000 Link to comment https://forums.phpfreaks.com/topic/227219-changing-date-to-rfc822-format/#findComment-1172124 Share on other sites More sharing options...
BlueSkyIS Posted February 10, 2011 Share Posted February 10, 2011 I prefer to have four-digit year as Mon, 15 Aug 2005 15:52:01 +0000 you do understand that this is not RFC 822 per your original question? just in case it is important that you have actual RFC 822. Link to comment https://forums.phpfreaks.com/topic/227219-changing-date-to-rfc822-format/#findComment-1172172 Share on other sites More sharing options...
etrader Posted February 10, 2011 Author Share Posted February 10, 2011 Sorry for that. I thought that RFC 822 can have four-digit year. I think DATE_RFC2822 or DATE_RFC1123 suits my need Link to comment https://forums.phpfreaks.com/topic/227219-changing-date-to-rfc822-format/#findComment-1172195 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.