Forum OpenACS Development: Value of getlastmodified for a file obtained through WebDAV

I'm writing a script to synchronize a remote file system and an instance of file-storage through WebDAV.

The context is: OACS 5.3/PgSQL 8.1

The date/time when a file was last modified is returned by the oacs-dav package through the query


in file tcl/oacs-dav-procs-postgresql.xql

The portion of the query that gets this date/time is:

to_char(timezone('GMT',o.last_modified) :: timestamptz ,
'Dy, DD Mon YYYY HH:MM:SS TZ') as last_modified

If o.last_modified is: 2007-06-27 22:05:47.340705+02
The returned value is: Wed, 27 Jun 2007 08:06:47 CEST

I think there are three incorrect things with the result:

1) The hour should be in 24hour format, 08 with no other information refers to 8am, instead of 8pm. I checked the postgresql manual and to obtain a 24 hour format the string that should be used is HH24 instead of HH.

2) The minute is incorrect. It should be 05 instead of 06. The error is that the MM in the format refers to the month, to get the minutes it should be MI.

3) The timezone is incorrect. The query first gets the date/time in GMT and then adds back the timezone (CEST) which I believe introduces an error of exactly the offset of CEST. I think the ':: timestampz' suffix in the first parameter of to_char is not needed.

If the analysis is correct, the query portion should be modified to:
to_char(timezone('GMT',o.last_modified), 'Dy, DD Mon YYYY HH24:MI:SS TZ') as last_modified

Did I miss something here?

This looks good to me.