Jump to content

datetime to atom


louis_coetzee

Recommended Posts

Hi Everyone,

 

Please have a look at this, and tell me if its right?

I am generating a sitemap for my website dynamically.

 

The date I am providing: 2012-02-24 11:56:09 and this is the output I am getting: 2012-02-24T11:56:09Z

now I am not sure of the Z at the end of the returned value.

 

I think I am looking for something similar to this: 2012-03-12T12:00:02+02:00

 

not to sure what I am doing wrong and where it gets the timezone from, I am guessing from the php config file.

 

any help would be much appreciated. thanks

 

My code:

 

<lastmod><?php echo $time->toAtom($post['Post']['modified']); ?></lastmod>

Link to comment
https://forums.phpfreaks.com/topic/258726-datetime-to-atom/
Share on other sites

Then unset it in the php.ini and let it pick up the timezone from the computer. If that doesn't work (or I'm just misunderstanding you) then set date.timezone according to this list (basically, pick whichever city is closest and in the same timezone with the same DST rules).

Link to comment
https://forums.phpfreaks.com/topic/258726-datetime-to-atom/#findComment-1326369
Share on other sites

cool, did that, now if I echo date("n");

 

I get: Mon, 12 Mar 2012 15:01:29 +0200 - which is correct.

 

But with the date to atom, it still shows: 2012-03-12T15:03:34Z with the Z at the end. Why is it not showing it with the +02:00 at the end?

 

Thanks for your help so far.

Link to comment
https://forums.phpfreaks.com/topic/258726-datetime-to-atom/#findComment-1326390
Share on other sites

Probably because the $time->toAtom() function does it that way intentionally. Look at its code.

 

Let me reiterate: there's nothing wrong with what it's doing (provided it's not doing anything wrong). Whether it shows noon UTC or 2pm UTC+2 doesn't really matter.

Link to comment
https://forums.phpfreaks.com/topic/258726-datetime-to-atom/#findComment-1326544
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.