MySQL Date Conversion Problem
Dave Cragg
dcragg at lacscentre.co.uk
Mon Apr 11 10:16:58 EDT 2005
On 9 Apr 2005, at 13:11, Marvin Wurth wrote:
> -- 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.
>
>
I see the same problem here. But if I change the conversion function as
follows, it works OK.
function SystemDate pDate
if pDate is empty then return the short system date
replace "-" with comma in pDate
put ",2,0,0,0" after pDate --CHANGED HERE
convert pDate from dateItems to short system date
return pDate
end SystemDate
Cheers
Dave
More information about the use-livecode
mailing list