Fog Creek Software
Discussion Board




Knowledge Base
Documentation
Terry's Tips
Darren's Tips

Bug in setDateTimeFormat?

I'd like to update my rss.xml feed to include the 2.0 tag, <pubDate>.

I thought that the following would work:
<pubDate>{$ setDateTimeFormat "English (United States)" "^ddd', 'd MMM yyyy" "hh':'mm':'ss' PST'" $}{$a.filedDate$}</pubDate>

But it doesn't generate the time part.  Is there a way to generate a proper <pubDate> with CityDesk?

http://backend.userland.com/rss#ltpubdategtSubelementOfLtitemgt

David Blume
Tuesday, April 29, 2003

{$ setDateTimeFormat "English (United States)" "^ddd, d MMM yyyy" "hh:mm:ss" $}{$.filedDate$} {$.filedtime$} PST

You need {$a.filedtime$}

www.marktaw.com
Tuesday, April 29, 2003

Here's the output:

Sun, 17 Nov 2002 02:23:46 PST

www.marktaw.com
Tuesday, April 29, 2003

And here's the quick reference. I find it indespensible. I hope Fog puts a link to it in CityDesk. Preferrably in the article edit window in advanced view...

http://www.fogcreek.com/CityDesk/help/Scripting_With_CityScript/ScriptingQuickReference.html

www.marktaw.com
Tuesday, April 29, 2003

Wow!  Fast reply Mark!

But that's not it.  Of course I was using {$a.filedtime$}, the date was correct.  The time was not being printed.

Here's the xml source:

<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE rss PUBLIC "-//Netscape Communications//DTD RSS 0.91//EN"
"http://p.moreover.com/xml_dtds/rss-0_91.dtd">
<rss version="2.0">

<channel>
<title>Daddy Blog</title>
<link>http://www.daliblume.com</link>
<description>Anecdotal stories about fatherhood.</description>
<language>en-us</language>
<copyright>Copyright 2002-3 David Blume.</copyright>
<managingEditor>dblume@pinnaclesys.com</managingEditor>
<webMaster>dblume@pinnaclesys.com</webMaster>

<image>
<title>Daddy Blog</title>
<url>http://www.daliblume.com/blog/Images/rss.jpg</url>
<link>http://www.daliblume.com</link>
<width>100</width>
<height>20</height>
<description>Anecdotal stories about fatherhood.</description>
</image>

{$ foreach 10 a in (folder "blog\2002") sortDescendBy .filedDate $}
<item>
<title>{$ a.headline $}</title>
<link>http://www.daliblume.com/{$ a.link $}</link>
<description>
<![CDATA[<SPAN>
{$ a.teaser $}
</SPAN>]]>
</description>
<pubDate>{$ setDateTimeFormat "English (United States)" "^ddd', 'd MMM yyyy" "HH':'mm':'ss" $}{$a.filedDate$} 11:00:00 PST</pubDate>
</item>
{$ next $}

</channel>
</rss>

On a Windows XP Home system, you'll see that the fieldDate ignores the time format.  Look at the results at: http://www.daliblume.com/rss.xml to see the results of the above script.

Notice that if my script worked as well as yours, then I should get something like

Sun, 17 Nov 2002 02:23:46 11:00:00 PST

Because I hardcode the 11:00:00 into it.

But, because of the bug, it only comes out as:

Sun, 17 Nov 2002 11:00:00 PST

David Blume
Tuesday, April 29, 2003

David, are you saying you inserted "{$.filedDate$} {$.filedTime$}" as Mark suggested? Or did you just use one of the two variables? You don't have both in your code snippet, so I just want to be clear. It'll only work with both.

Darren Collins
Tuesday, April 29, 2003

Yeah.

I think the confusion comes from the fact that you set both the date & time formats in one location, yet when you call them up, you have to use two seperate commands.

www.marktaw.com
Tuesday, April 29, 2003

The scripting quick reference is in the help file in citydesk.  If you are editing an article (or a file) it can be selected from the help menu

Joel Goldstick
Tuesday, April 29, 2003

Joel - I know that. I would like a link *straight* to the reference.

www.marktaw.com
Tuesday, April 29, 2003

Sorry Mark, Darren.
I didn't use both {$.filedDate$} {$.filedTime$} as is evident in the code I pasted.

The other lesson:  Don't think you can do just one easy little site change while your two-year-old is crawling all over you.

Mea culpa.

Other news:  FeedReader still doesn't reflect my <pubDate>  guess I'll try <dc:date> next.

Thanks, everyone!

www.daliblume.com
Tuesday, April 29, 2003

*  Recent Topics

*  Fog Creek Home