Hi Klaus - I was just thinking someone out there must have a ready made
handler as it is real common format on the internet. I've given a go below -
I include some info for reference:

A common use could be [YYYY]-[MM]-[DD]T[hh]:[mm]:[ss]±[hh]:[mm].
"1981-04-05T14:30:30-05:00", for example.


Two good references:

  1. http://www.w3.org/TR/NOTE-datetime
  2. http://en.wikipedia.org/wiki/ISO_8601#Combined_representations

So it's basically dateitems with dashes a "T" in the middle and a "Z" or bit
from the internet time (UTC) at the end - not too clear on the timezone
stuff.

UTC

If the time is in UTC<http://en.wikipedia.org/wiki/Coordinated_Universal_Time>,
it is very easy to show this. Simply add a 'Z' directly after the time,
without a space. "09:30 UTC" is therefore represented as "09:30Z" or
"0930Z". "14:45:15 UTC" would be "14:45:15Z" or "144515Z".

[edit<http://en.wikipedia.org/w/index.php?title=ISO_8601&action=edit&section=12>
] Other time zones

Other time zones are specified by their *offset* from UTC, in the format
±[hh]:[mm], ±[hh][mm] or ±[hh]. So if the time being described is one hour
ahead of UTC (such as the time in Berlin<http://en.wikipedia.org/wiki/Berlin>during the winter) the offset 
would be "+01:00", "+0100" or simply "+01".
This is appended to the time in the same way that 'Z' was above. Note that
the offset is the actual offset from UTC, and does not include any
information on daylight saving 
time<http://en.wikipedia.org/wiki/Daylight_saving_time>.
Times expressed in local time for a user in 
Chicago<http://en.wikipedia.org/wiki/Chicago>would be "-06:00" for the winter 
(Central
Standard Time <http://en.wikipedia.org/wiki/Central_Standard_Time_Zone>)
and "-05:00" for the summer (Central Daylight 
Time<http://en.wikipedia.org/wiki/Central_Daylight_Time_Zone>).
The following times all refer to the same moment: "18:30Z", "22:30+04",
"1130-0700" and "15:00-03:30".

So this seems to work:

function date_Construct8601 someDate
   -- ie "1981-04-05T14:30:30-05:00"
   convert someDate to internet date
   put word -1 of somedate into utcOffset
   convert someDate to dateItems
   put item 1 to 3 of someDate into dateBit
   replace comma with "-" in dateBit
   put item 3 to 6 of somedate into timeBit
   replace comma with ":" in timeBit

   return dateBit & "T" & timeBit & utcOffset
end date_Construct8601
_______________________________________________
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution

Reply via email to