Jump to content

atom feed date format


bhavin12300

Recommended Posts

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?

 

 

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.