Date format

I want a text field to display “Le Mardi 23 dcembre 2014”. So I wrote this code in the opening event of the field:

dim d As Date = Date.Now Dim t As Text = "Le " + d.ToText(Locale.Current, Date.FormatStyles.Full, Date.FormatStyles.None) me.Text = t

But I got “Le Tuesday, December 23, 2014”

Obviously, I miss something…

[quote=154649:@Gilles Rioux]I want a text field to display “Le Mardi 23 décembre 2014”. So I wrote this code in the opening event of the field:

dim d As Date = Date.Now Dim t As Text = "Le " + d.ToText(Locale.Current, Date.FormatStyles.Full, Date.FormatStyles.None) me.Text = t

But I got “Le Tuesday, December 23, 2014”

Obviously, I miss something…[/quote]

I don’t think so, assuming you’ve the correct settings in Language & Region (both of which I set to French to test this), it should show what you’re expecting. Looks like a bug to me.

Thank you Gavin.

I assure you that I have a full french setting in my OSX 10.10.1 MacBook Pro.

So, waiting for 2015R1.

[quote=154656:@Gilles Rioux]Thank you Gavin.

I assure you that I have a full french setting in my OSX 10.10.1 MacBook Pro.

So, waiting for 2015R1.[/quote]
It’ll be the iOS Simulator (or the device you’re deploying to) where you’ll want to check the Lang & Region settings. Regardless, I changed mine temporarily to French but couldn’t get the date “in French” either.

After a serious battle with the code, here is a winner :

Your last comment put me on the good direction.

I should note that Locale.Current is actually working fine- and you can see that on a real device. But you should be aware there is a bug in the simulator that Apple should be addressing in the next point release:

“Localization and Keyboard settings, including 3rd party keyboards, are not correctly honored by Safari, Maps, and developer apps in the iOS 8.1 Simulator. [NSLocale currentLocale] returns en_US and only the English and Emoji keyboards are available. (18418630, 18512161)”

xojo for iOS seems as complicated as xcode and objective c … ? :wink:

Bugs in the iOS simulator are out of our hands.

[quote=154649:@Gilles Rioux]I want a text field to display “Le Mardi 23 décembre 2014”. So I wrote this code in the opening event of the field:

dim d As Date = Date.Now Dim t As Text = "Le " + d.ToText(Locale.Current, Date.FormatStyles.Full, Date.FormatStyles.None) me.Text = t

But I got “Le Tuesday, December 23, 2014”

Obviously, I miss something…[/quote]

The simulator locale is bezerk. For instance, if you select the French keyboard in Preferences, or even set the interface to Français, it will insist on showing the US keyboard.

You want to try on the device for that. Chances are everything will be fine.

If it still did not work, well, why not use a 7 slot array for week, and 12 for months and use the day and month as index ? Impossible n’est pas français :wink:

[quote=154674:@Michel Bujardet]The simulator locale is bezerk. For instance, if you select the French keyboard in Preferences, or even set the interface to Français, it will insist on showing the US keyboard.

You want to try on the device for that. Chances are everything will be fine.

If it still did not work, well, why not use a 7 slot array for week, and 12 for months and use the day and month as index ? Impossible n’est pas français ;)[/quote]

Yes I went with this solution. Y’a toujours moyen de moyenner, comme on dit au Québec :slight_smile: