MySQL Date Conversion Problem
Sarah Reichelt
sarahr at genesearch.com.au
Mon Apr 11 19:34:39 EDT 2005
I bet you just switched to daylight-savings time :-)
This is a 'feature" of Rev on OS X that has been driving me crazy for
ages.
Dave's solution is the correct one, just put a 2 in the dateitems.
Cheers,
Sarah
On 11 Apr 2005, at 6:04 PM, Marvin Wurth wrote:
> I have found the following problem and would like someone to please
> confirm my findings before I post Bug report.
>
> I have been using the following functions posted by Sarah Reichelt to
> convert dates from MySQL to Revolution and back to MySQL. The
> functions
> are:
>
> -- 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
>
>
> I been using the functions for about 6 months and they work great!
> Thanks
> Sarah. But yesterday I noticed working in Revolution 2.5.1 on Mac OS X
> 10.3.8, that when a date came in from MySQL, Revolution was displaying
> one
> day earlier. For example if the date in MySQL which is formatted as
> '2005-02-01' was converted to '01/31/05'. The conversion back to MySQL
> works correctly. What is even stranger is if the date is in the same
> week
> as the current date then the conversion is correct. For example
> '2005-04-08' to '04/08/05' works correctly.
>
> When I tested the functions with different platforms and versions of
> Revolution, I found the following results.
>
> Windows XP SP2, Revolution 2.1.2 works correctly.
> Windows XP SP2, Revolution 2.5.1 works correctly.
> SuSE 9.2, Revolution 2.5 works correctly.
> Mac OS 9.2 in Classic Mode, Revolution 2.2.1 works correctly.
> Mac OS X 10.3.8, Revolution 2.1.2 works correctly.
> Mac OS X 10.3.8, Revolution 2.2.1 works correctly.
> Mac OS X 10.3.8, Revolution 2.5.1 failed.
>
> It looks to me like there is some type of problem in 2.5.1 and short
> system date. I have a small test stack I created for testing if any
> would
> like me to email it to them. If you have any questions, please let me
> know. Your help is much appreciated.
>
> Thanks,
>
> Marvin Wurth
More information about the use-livecode
mailing list