J. Landman Gay
jacque at hyperactivesw.com
Thu Jul 13 17:05:44 EDT 2023
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:
put the long time into tTime
convert tTime to dateItems
split tTime by ","
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]]")
-- Mark Waddingham, sql date and time:
function convertDateTimeToISO pDateTime
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)
-- Klaus Major, using seconds:
function smpt_lite tSecs
return format("%02d:%02d:%02d", tSecs div 3600, (tSecs mod 3600) div 60,
tSecs mod 60)
Jacqueline Landman Gay | jacque at hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
More information about the use-livecode