Date format

Hi All

This maybe one of those I’m a little brain dead things.

I have an App on XojoCloud & when deployed the dates show in Safari & Chrome as month, day, year - 1/31/2017. However on my desktop(Mac) when testing the dates show as expected day, month, year - 31/01/2017.

What am I missing?



Your Mac local date is set to day, month, year - 31/01/2017.

Just like languages, many people use different way to set the date.

HTTPHeaders uses: Accept-Datetime: Thu, 31 May 2007 20:35:00 GMT.

Date formatting code uses the format of the system it is running on. When you are testing, it uses your system date since that is where the web app is running. When deployed it is using the Xojo Cloud system date, which will vary depending on where it is hosted.

To display the date with the browser locale:$WebDateNumber

Thanks Paul

Our server is in Sydney Australia so I’m guess that you have all the XojoCloud servers set to the US date format.

Anyway that means I have to set the format for all the date fields it the App. Dam…

Paul - I just test drove the code you linked to, as I’ve been wrangling with locales and dates recently as well (I’m in the UK). I tried it with Chrome, Edge and IE on Windows, and in each case the “langCode” variable in the sample code gets set to “en” and the date comes out in American date order, as Chris says.

The PC I’m running the browsers on has the locale set to “English (United Kingdom)”, so I hoped the “langCode” would get set to “en-gb” instead of “en”, and date displayed as “16 January 2017” instead of “January 16 2017”.

Is there another way (apart from manually coding around it), or are all English-speaking countries stuck with US date order in this scenario?

The WebSession.LanguageCode property only contains the language. Perhaps one of the header values might have more information? Maybe WebSession.Header(“Accept-Language”)?

Ah yes! The “Accept-Language” header gets set to “en-GB,en-US;q=0.8,en;q=0.6”.

Nice one Paul, thanks.