bhavin12300 Posted March 6, 2010 Share Posted March 6, 2010 hi, i am parsing one atom feed in my php script. in which there is one tag called <update> which contain following value. 2010-02-19T17:23:53-05:00 in browser its displayed as "Saturday, February 20, 2010 3:53 AM" can any one let me know how to get same value in php script? Quote Link to comment https://forums.phpfreaks.com/topic/194314-atom-feed-date-format/ Share on other sites More sharing options...
gizmola Posted March 6, 2010 Share Posted March 6, 2010 date_default_timezone_set('America/Los_Angeles'); $date = strtotime('2010-02-19T17:23:53-05:00'); echo date('r', $date); You'll want to look at the manual page for the date function to figure out what your desired date string is. I used 'r' because it was simple and close, but you can construct any date format you desire. In some cases, you need to set default_timezone_set(), so you should set that relative to your server. Quote Link to comment https://forums.phpfreaks.com/topic/194314-atom-feed-date-format/#findComment-1022234 Share on other sites More sharing options...
bhavin12300 Posted March 6, 2010 Author Share Posted March 6, 2010 its giving be FEB ,19 but when i see real feed in browser, its giving me feb ,20 (this "Saturday, February 20, 2010 3:53 AM" for ) Quote Link to comment https://forums.phpfreaks.com/topic/194314-atom-feed-date-format/#findComment-1022235 Share on other sites More sharing options...
bhavin12300 Posted March 6, 2010 Author Share Posted March 6, 2010 date_default_timezone_set('America/Los_Angeles'); $date = strtotime('2010-02-19T17:23:53-05:00'); echo date('r', $date); thanks, i got it. i set date_default_timezone_set('Asia/Calcutta'); and its solved. thanks. You'll want to look at the manual page for the date function to figure out what your desired date string is. I used 'r' because it was simple and close, but you can construct any date format you desire. In some cases, you need to set default_timezone_set(), so you should set that relative to your server. Quote Link to comment https://forums.phpfreaks.com/topic/194314-atom-feed-date-format/#findComment-1022237 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.