is a date

Bob Sneidar bobsneidar at iotecdigital.com
Mon Oct 16 13:34:29 EDT 2017


May want to check out the MasterLibrary then. It's got a lot of great commands and functinos, one of which will format a date any way you like, including sql date. 

Bob S


> On Oct 16, 2017, at 10:14 , Andrew Bell via use-livecode <use-livecode at lists.runrev.com> wrote:
> 
>> From: Bob Sneidar <bobsneidar at iotecdigital.com>
>> To: How to use LiveCode <use-livecode at lists.runrev.com>
>> Subject: Re: is a date
>> Message-ID: <6EB529A3-5D21-4186-BD90-641746E96734 at iotecdigital.com>
>> 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
> 
> 
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode





More information about the use-livecode mailing list