CDate uses UTC and, without the time information in the string, it would store 
midnight. Format uses local time.

So, anyone in a time zone behind UTC will get the previous day printed. Try 
this format string:
zTestResult = Format(CDate(zTestDate), "mm/dd/yy hh:nn ddd")

Does the difference in hours match your timezone offset?


-- 
Lee


On 05/19/2018 09:08 AM, Gianluigi wrote:
> I think it depends on your version of Gambas, I get the correct result with
> the master:
> 
>   Dim zTestDate As String
>   Dim zTestResult As String
>   zTestDate = "5/4/2018"
>   zTestResult = Format(CDate(zTestDate), "mm/dd/yy ddd")
>   Debug "Test date: " & zTestDate & " Formatted: " & zTestResult
>   '' Result: Main.Main.9: Test date: 5/4/2018 Formatted: 05/04/18 ven
> 
> Regards
> Gianluigi

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user

Reply via email to