is a date

andrew at andrew at
Mon Oct 16 13:14:19 EDT 2017

> From: Bob Sneidar <bobsneidar at>
> To: How to use LiveCode <use-livecode at>
> Subject: Re: is a date
> Message-ID: <6EB529A3-5D21-4186-BD90-641746E96734 at>
> Content-Type: text/plain; charset="us-ascii"
> This probably matters to no one at all, but SQL does not store dates  
> with forward slashes. SQL datetime formats look like this:
> yyyy-dd-mm hh:mm:ss
> Bob S

It mattered to me recently on a project I was working on so I wrote  
these two scripts to help me generate a LC version of the mySQL  
version of "timestamp":

on timeStamp
    put the internet date into tTheDate
    convert tTheDate to dateitems
    put item 1 of tTheDate into tYear
    put item 2 of tTheDate into tMonth
    put item 3 of tTheDate into tDay
    put item 4 of tTheDate into tHour
    put item 5 of tTheDate into tMinute
    put item 6 of tTheDate into tSecond

    leadingZero tMonth
    leadingZero tDay
    leadingZero tHour
    leadingZero tMinute
    leadingZero tSecond

    put tYear & "-" & tMonth & "-" & tDay && tHour & ":" & tMinute &  
":" & tSecond into tTimeStamp
    return tTimeStamp
end timeStamp

on leadingZero @pDateItem
    if the length of pDateItem = 1 then
       put "0" before pDateItem
    end if
end leadingZero

A new date/time format of "database" would be useful for something like this.

--Andrew Bell

More information about the use-livecode mailing list