Currently, I am using the .shortDate value but that shows up as a 2 digit year. .LongDate shows the 4 digit year but everything is too long. I could format to a certain format using string but it will not comply to the locale settings.
Is there a way to format the date year to a 4 digit year and yet keep the locale settings ?
that’s true. I just couldn’t find any way around it. It would have been so much easier if the world follows one date format or at least placed the year at the back.
in fact, it is the user responsability to select 4 digits instead of 2 in the system preference panel.
I have an abbreviated date that outputs 4 digits on my system…
[code] dim d as xojo.Core.Date = Xojo.Core.Date.Now
Dim myLocale As New Xojo.Core.Locale(“fr-FR”)
Dim t As Text = d.ToText(myLocale,Xojo.Core. Date.FormatStyles.Short, Xojo.Core.Date.FormatStyles.None)
msgbox t[/code]
Result : 18/09/2016
To keep the system settings, use Locale.current
But indeed there is something when I do that with en-US, it shows the year in two digits, although my PC system preferences short date is set specifically to M/d/yyyy. Could be a bug in xojo.core.date.
Michel, it depends on how the user defines a “short” date in the system preferences.
if the user choose 2 digits, then the locale short date will return 16 and not 2016.
[quote=287498:@Jean-Yves Pochez]Michel, it depends on how the user defines a “short” date in the system preferences.
if the user choose 2 digits, then the locale short date will return 16 and not 2016.[/quote]
Precisely not with Xojo.Core.Date in the example above for Locale.Current on a US system . Why I think it is a Xojo bug.