Feedback Case Number: 57838
Please see <https://xojo.com/issue/57837 >
DateTime.ToString has severe localization issues with international locales.
And I remember having seen another thread here with a 40 minutes time shift for Amsterdam locale.
This is an API 2.0 bug. Please fix it. It consumes a lot of time to create workarounds.
Additional info:
I think the new DateTime.ToString is giving incorrect result on Windows
Dim d as Date = new Date
MessageBox d.ShortDate // Gives 10/11/2019 - Correct
Dim d2 as DateTime = DateTime.Now
MessageBox d2.ToString(Locale.Current, DateTime.FormatStyles.Short, DateTime.FormatStyles.None) // Gives 10/11/19 - Incorrect
My system short date format in control panel on the Windows is: M/d/yyyy
Edit: Tossed in bug report also: 57837 - DateTime.ToString gives incorrect result
Clearly this is a bug on (Xojo?) MacOS side:
Note i use DateTime instead of Date since “Date” is deprecated.
Windows DateTime instance (works correctly):
Note: Windows has one bug an that is DateTime.DayOfWeek shows 2 while it should be 1 since the day starts @ monday and the day on the image below is monday:
[windows_datetime_xojo]
Windows FolderItem.ModificationDateTime:
[windows_folderitem_modification_datetime_xojo]
Both Date and Time seem to be correct in “Europe/Amsterdam” or GMTO…
DateTime is basically not safe to use as it is given the programmer will not have much chance to predict how it will behave wrong in each locale.
Yes. The easiest fix currently is to revert to Date.