Date and time format question

Niggemann, Bernd Bernd.Niggemann at uni-wh.de
Tue Jul 30 06:20:32 EDT 2024


Similar to Bob's and Jaque's but includes the delimiters:

Additionally adds Minutes and +- offsets


E.g. Nepal is 5 Hours 45 Minutes ahead of GMT/UTC

----------------------------------------------------------------------
   -- create UTC timestamp: -- format: "2013-07-20T00:00:00Z"
   put the internet date into tTime
   put char 1 of the last word of tTime into tAddSubtract

   if tAddSubtract is "-" then
      put true into tAdd
   end if

   put char 2 to 3 of the last word of tTime into tHoursOff
   put char 4 to 5 of the last word of tTime into tMinutesOff

   convert tTime to dateItems
   if tAdd then
      add tHoursOff to item 4 of tTime
      add tMinutesOff to item 5 of tTime
   else
      subtract tHoursOff from item 4 of tTime
      subtract tMinutesOff from item 5 of tTime
   end if
   convert tTime to dateItems

   set the numberformat to "00"
   put item 1 of tTime &"-"& (item 2 of tTime)+0 &"-"& (item 3 of tTime)+0 & "T" & (item 4 of tTime)+0 &":"& \
         (item 5 of tTime)+0 &":"& (item 6 of tTime)+0 & "Z" into tTimestamp
   put tTimeStamp
----------------------------------------------------------------------

Kind regards
Bernd


More information about the use-livecode mailing list