Skip to content

Web DatePicker Quick Tip: Check Your Settings

Read on for a quick tip about using Xojo’s Web DatePicker. I was using the DatePicker control on a web page and the results didn’t look correct.

You can see that the DatePicker is rendering the date in M/D/Y format, but here in New Zealand (and a lot of other places) we use D/M/Y as seen in the Locale.Current text field.

I then looked at and I can see that this site that is dedicated to dates and times is also rendering dates in M/D/Y format.

This led me to believe that my browser wasn’t giving the correct language code to these sites. I did a little digging and found that my browser has a Languages setting and mine was defaulting to English (United States). And the United States, unlike New Zealand, uses M/D/Y.

To fix this I added my language to the browser and set it to be the first in the list.

Now renders dates in D/M/Y format.

And the DatePicker in my Xojo project now renders correctly as well.

And I didn’t change a single line of code in my Xojo project to fix it!

Wayne Golding has been a Xojo developer since 2005 and is a Xojo MVP. He operates the IT Company Axis Direct Ltd which primarily develops applications using Xojo that integrate with Xero Wayne’s hobby is robotics where he uses Xojo to build applications for his Raspberry Pi, often implementing IoT for remote control.