On 7/13/23 3:19 AM, Neville Smythe via use-livecode wrote:
I seem to have hallucinated that the built-in convert handler recognised the 
ISO date and dateTime formats (YYYY-MM-DD, YYYY-MM-DD hh:mm:ss+-hh.ss, etc) but 
I must have written my own conversion routines in a former life.

But one would have to ask… Why doesn’t it? After all, the original ISO 8601 
standard was adopted 1988!

I've been collecting handlers for this for some years. I have four now. I didn't note where the first two came from, but here's what I have:

on formatTime
  put the long time into tTime
  convert tTime to dateItems
  split tTime by ","
  return format("%02d:%02d:%02d",tTime[4],tTime[5],tTime[6])
end formatTime


function sqlDate pDate
  convert pDate to dateitems
  set the numberformat to "00"
  return merge("[[item 1 of pDate]]-[[item 2 of pDate + 0]]-[[item 3 of pDate + 
0]]")
end sqlDate



-- Mark Waddingham, sql date and time:

function convertDateTimeToISO pDateTime
  local tTimeZone
  convert pDateTime to internet date
  put the last word of pDateTime into tTimeZOne
  convert pDateTime to dateitems
  return format("%04d-%02d-%02d %02d:%02d:%02d%s", \
        item 1 of pDateTime, item 2 of pDateTime, item 3 of pDateTime, \
        item 4 of pDateTime, item 5 of pDateTime, item 6 of pDateTime, 
tTimeZone)
end convertDateTimeToISO


-- Klaus Major, using seconds:
function smpt_lite tSecs
   return format("%02d:%02d:%02d", tSecs div 3600, (tSecs mod 3600) div 60,
tSecs mod 60)
end smpt_lite

--
Jacqueline Landman Gay         |     jac...@hyperactivesw.com
HyperActive Software           |     http://www.hyperactivesw.com

_______________________________________________
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Reply via email to