Using database linked controls with MySQL

Sarah Reichelt sarahr at
Tue Jul 27 22:28:32 CDT 2004

On 28 Jul 2004, at 8:23 am, Bill wrote:

> But this time I'm hoping someone knows how to easily format dates in 
> the
> manner that MySQL expects them. Dates have to be yyyy-mm-dd.
> The format runrev gives me is mm/dd/yy. I could write a complex thing 
> that
> would convert it every time but maybe there is a built in format or 
> someone
> has a nice conversion function I could use.
It's only the sort of thing you would have written for yourself, but 
here are my functions for SQL date conversions:

-- converts a system short date into an SQL format date
-- uses current date if none supplied
function SQLDate pDate
   if pDate is empty then put the short system date into pDate
   convert pDate from short system date to dateItems
   return item 1 of pDate & "-" & item 2 of pDate & "-" & item 3 of pDate
end SQLDate

-- reverse function to convert SQL date to short system date
function SystemDate pDate
   if pDate is empty then return the short system date
   replace "-" with comma in pDate
   put ",0,0,0,0" after pDate
   convert pDate from dateItems to short system date
   return pDate
end SystemDate


More information about the use-livecode mailing list