Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#1 2007-04-02 16:12:59
- J. Brisbin
- New Member
- Registered: 2007-03-22
- Posts: 4
XML-RPC not using ISO dates, so posts don't show up for hours
I’m using MacJournal to post to my blog (have been since switching from WP) and it sends the GMT date of the post, not the time zone-corrected version of the date. I’m in Central Time (US), and it’s daylight savings time now, but when I post using XML-RPC and MacJournal, my posts are dated 6 hours into the future (they should be only 5). I’ve been back-dating them by 6 hours to get them to show up right away. This is not really a workable solution, though.
I contacted the author of MacJournal and he took a look and confirmed that TXP is not using ISO dates for the CreatedOn field. He looked at WordPress’ implementation of XML-RPC and I did too. It’s using IXR as well, but there’s a number of other functions in there that aren’t in the TXP plugin. Specifically, WP is using a getIso() function instead of TXP’s getTimestamp().
I tried, quite unsucessfully, to hack TXP’s XML-RPC to include the other functions from WP’s XML-RPC, but that didn’t work (probably because I’m not 100% sure I know what I’m doing). If anyone can help me here, I would really appreciate it. I just need to know what other functions I can call, or what I specifically need to change to have TXP translate the GMT date sent by my blogging client to the time-zone-corrected version that TXP expects.
Thanks!
Jon Brisbin
http://jbrisbin.com
Offline
#2 2007-04-02 16:26:35
- Mary
- Sock Enthusiast
- Registered: 2004-06-27
- Posts: 6,236
Re: XML-RPC not using ISO dates, so posts don't show up for hours
Are you talking about this or something else?
Offline
#3 2007-04-02 17:10:09
- J. Brisbin
- New Member
- Registered: 2007-03-22
- Posts: 4
Re: XML-RPC not using ISO dates, so posts don't show up for hours
Yes, that’s the thing I’m talking about. The main TXP XML-RPC download.
Offline
#4 2007-04-03 05:21:41
- zem
- Developer Emeritus

- From: Melbourne, Australia
- Registered: 2004-04-08
- Posts: 2,579
Re: XML-RPC not using ISO dates, so posts don't show up for hours
Any chance you can capture an example of an XML-RPC call that demonstrates the problem?
Alex
Offline
#5 2007-04-03 13:37:09
- J. Brisbin
- New Member
- Registered: 2007-03-22
- Posts: 4
Re: XML-RPC not using ISO dates, so posts don't show up for hours
<?xml version="1.0" encoding="UTF-8"?>
<methodCall>
<methodName>metaWeblog.newPost</methodName>
<params>
<param>
<value>
<string>article</string>
</value>
</param>
<param>
<value>
<string>{USERNAME}</string>
</value>
</param>
<param>
<value>
<string>{PASSWRD}</string>
</value>
</param>
<param>
<value>
<struct>
<member>
<name>title</name>
<value>
<string>test</string>
</value>
</member>
<member>
<name>categories</name>
<value>
<array>
<data>
<value>
<string>the-writing-life</string>
</value>
<value>
<string>the-writing-life</string>
</value>
<value>
<string>the-writing-life</string>
</value>
<value>
<string>the-writing-life</string>
</value>
<value>
<string>the-writing-life</string>
</value>
<value>
<string>the-writing-life</string>
</value>
<value>
<string>the-writing-life</string>
</value>
<value>
<string>the-writing-life</string>
</value>
<value>
<string>the-writing-life</string>
</value>
<value>
<string>the-writing-life</string>
</value>
<value>
<string>the-writing-life</string>
</value>
</data>
</array>
</value>
</member>
<member>
<name>dateCreated</name>
<value>
<dateTime.iso8601>20070402T19:47:27Z</dateTime.iso8601>
</value>
</member>
<member>
<name>description</name>
<value>
<string>test</string>
</value>
</member>
<member>
<name>mt_allow_comments</name>
<value>
<i4>1</i4>
</value>
</member>
</struct>
</value>
</param>
<param>
<value>
<boolean>1</boolean>
</value>
</param>
</params>
</methodCall>
The real time this was posted was 2:47 p.m. CDT. When it got to Textpattern, the posted date didn’t take into account the time zone and used the GMT timestamp as the local time timestamp. The way I’ve fixed this problem for now is by doing this:
$contents['Posted'] = date('Y-m-d H:i:s',$struct['dateCreated']->getTimestamp()-18000);
I’ll have to change this when Daylight Savings Time ends in the fall, but this is the only way I could get my posts to show up right away (everything else I tried failed miserably).
Offline
#6 2007-04-03 22:02:28
- zem
- Developer Emeritus

- From: Melbourne, Australia
- Registered: 2004-04-08
- Posts: 2,579
Re: XML-RPC not using ISO dates, so posts don't show up for hours
Try this:
$contents['Posted'] = date('Y-m-d H:i:s',$struct['dateCreated']->getTimestamp()+tz_offset());
Last edited by zem (2007-04-03 22:06:37)
Alex
Offline