We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

XMLGrab Strange Date Problem

Development and Programming

Squanto's avatar
Squanto
7 posts
16 years ago
Squanto's avatar Squanto

I’m using the XMLGrab plugin to pull in an xml feed, everything is working fine save for one thing: when I pass the feed’s date into EE as the entry date variable it shows up as one day earlier.

For example

xml element:

<date>2009-01-17</date>

EE Entry Date: “2009-01-16 07:00 PM”

Localization settings are correct for my setup, and since I’m running an ancient build of EE (v1.5.2!!!) I’d thought it may be the old time bug, but that would muck it up by a few hours not an entire day. I saw one thread here where an import of date data caused a similar problem, and their fix was to change the time from PM to AM but I have no means to do that. Thoughts?

       
Lisa Wess's avatar
Lisa Wess
20,502 posts
16 years ago
Lisa Wess's avatar Lisa Wess

Hi, Squanto - when you create entries within the control panel, are the dates/times correct?

       
Squanto's avatar
Squanto
7 posts
16 years ago
Squanto's avatar Squanto

Yes, perfect. It’s only these imported dates (future dates to be exact), that step back a day.

       
Lisa Wess's avatar
Lisa Wess
20,502 posts
16 years ago
Lisa Wess's avatar Lisa Wess

Alright, I’m going to move this down to the Plugins forum then; I’d recommend contacting the author to see if he has any ideas on getting this fixed up.

       
Squanto's avatar
Squanto
7 posts
16 years ago
Squanto's avatar Squanto

Thanks Lisa for moving this… For completeness sake attached below is what Andrew the developer has emailed me:

Thanks for your email. I suspect it is a timezone/localisation issue. I’ll take a look into the plugin to see if it is doing anything wrong, but in the mantime you could try adding an offset parameter to the plugin call {exp:xmlgrab … offset=”18000” …} this should alter the time stamp by 5 hours ( 5 hrs * 60 mins * 60 secs = 18000) Let me know if this helps or not.

I’ll try it out and if it does the trick I’ll post my fix here!

       
Squanto's avatar
Squanto
7 posts
16 years ago
Squanto's avatar Squanto

Still not sure why it’s happening, but I set my offset as a temporary solution to 12 hours in the future (offset=-43200) and the imported dates are now loading in at a default of the correct date and 7:00 PM. I’m going to install the latest EE upgrade tonight to see if I can remove the offset and load them as the correct date.

       
Squanto's avatar
Squanto
7 posts
16 years ago
Squanto's avatar Squanto

I’ve contacted Andrew the developer and I’ll post his thoughts. Offset allows me to push the dates wherever I want them to be, however, it seems to break the check function of XMLGrab and begins loading duplicate entries each time the load call is made.

       
Squanto's avatar
Squanto
7 posts
16 years ago
Squanto's avatar Squanto

This is resolved. The problem wasn’t really a problem. It was a localization issue. The xml file had the date and time split across different elements, and the loaded date would default to 12:00 AM server time for it’s entry_date. Offset for EST, 7:00 PM the previous day. Duh.

       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.