steveclondon Posted February 6, 2007 Share Posted February 6, 2007 Hi I have a string time in my database that I want to convert into a time for use in RSS. The format I have is 20070206095354 which is yyyy dd mm hh mm ss I want to convert to this format Mon, 15 Aug 2005 15:52:01 UTC Also my server is one hour ahead of GMT so I want to take that into account. Link to comment https://forums.phpfreaks.com/topic/37271-convert-string-time-to-time-for-rss/ Share on other sites More sharing options...
PC Nerd Posted February 6, 2007 Share Posted February 6, 2007 its its a string your storing: youd have to explode or something, i dont know if its a timstamp ( it better be ) $timestamp; echo strtime(hh dd mm ) etc its off the top of my head, but investigate the time and date functions good luck Link to comment https://forums.phpfreaks.com/topic/37271-convert-string-time-to-time-for-rss/#findComment-178028 Share on other sites More sharing options...
JasonLewis Posted February 6, 2007 Share Posted February 6, 2007 like this? <?php $date = "20070206095354"; echo date("D, d M Y H:i:s", strtotime($date)); ?> Link to comment https://forums.phpfreaks.com/topic/37271-convert-string-time-to-time-for-rss/#findComment-178031 Share on other sites More sharing options...
steveclondon Posted February 6, 2007 Author Share Posted February 6, 2007 I have split my time. The main bit im stuck on is how to tell what day that date was. Link to comment https://forums.phpfreaks.com/topic/37271-convert-string-time-to-time-for-rss/#findComment-178040 Share on other sites More sharing options...
steveclondon Posted February 6, 2007 Author Share Posted February 6, 2007 I have also converted the date and time to a unix timestamp. So i just need to know the day either from that timestamp or the above string time. Link to comment https://forums.phpfreaks.com/topic/37271-convert-string-time-to-time-for-rss/#findComment-178042 Share on other sites More sharing options...
JasonLewis Posted February 6, 2007 Share Posted February 6, 2007 did you see my post above. the code i posted works. for me anyway. Link to comment https://forums.phpfreaks.com/topic/37271-convert-string-time-to-time-for-rss/#findComment-178043 Share on other sites More sharing options...
steveclondon Posted February 6, 2007 Author Share Posted February 6, 2007 No i get a date in 1970 for that instead of 2007. Strange hey Link to comment https://forums.phpfreaks.com/topic/37271-convert-string-time-to-time-for-rss/#findComment-178060 Share on other sites More sharing options...
JasonLewis Posted February 6, 2007 Share Posted February 6, 2007 that is strange, because it works fine for me. Link to comment https://forums.phpfreaks.com/topic/37271-convert-string-time-to-time-for-rss/#findComment-178105 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.