From: Bob Sneidar <bobsnei...@iotecdigital.com>
To: How to use LiveCode <use-livecode@lists.runrev.com>
Subject: Re: is a date
Message-ID: <6eb529a3-5d21-4186-bd90-641746e96...@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@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