convert does not understand daylight savings?

Sarah Reichelt sarah.reichelt at gmail.com
Sat Apr 17 19:49:04 EDT 2010


On Sun, Apr 18, 2010 at 6:33 AM, Sivakatirswami <katir at hindu.org> wrote:
> I have a rss reading agent that is super picky...
>
> a feed I generate using rev cgi
>
>
> put "04/12/2010" into startYear
>  convert startYear to seconds
>  put (24*60*60) * tLessonNo into tDate
>  add startYear to tDate
>  convert tDate to long english date
>  delete word 1 of tDate
>
>
> returns...
>
> <pubDate>Sat, 17 Apr 2010 00:00:01 PST</pubDate>
>
> but it should be returning <pubDate>Sat, 17 Apr 2010 00:00:01 PDT</pubDate>
>
> because of this, the feed is invalid by this particular agent's standards
> (it *does validate in any other validator...)
>
>
> How can I tweak "convert" to output Sat, 17 Apr 2010 00:00:01 PDT


Here is my function for returning an RSS formatted date & time:

-- start: August 01 2009
-- end: Wed, 02 Oct 2002 15:00:00 +0200

function generateRssDate pDate
	put word 1 of pDate into tMonthName
	put lineOffset(tMonthName, the monthnames) into tMonthNum
	put line tMonthNum of the abbreviated monthNames into tMonth

	put word 2 of pDate into tDay
	put word 3 of pDate into tYear

	put tYear & comma & tMonthNum & comma & tDay & ",12,0,0,0" into tDateItems
	convert tDateItems to short date
	convert tDateItems to dateItems
	put last item of tDateitems into tDayNum
	put line tDayNum of the abbreviated weekdayNames into tDayName

	-- time not stored, so set a fake one (edit this to your time zone)
	put "12:00:00 +1000" into tTime

	put tDayName & comma && tDay && tMonth && tYear && tTime into tRSSDate
	return tRSSDate
end generateRssDate


Adjust the line that sets the fake time to show your own time zone,
mine is +1000.
And change to suit your parameters, if they do not match what I am
supplying to the function.

When working with time stamps that have no specified time component, I
always use a default time of midday to avoid any possible problems
when the clocks change.

Cheers,
Sarah



More information about the use-livecode mailing list