reading the date acceptance pattern & locale setting

I’ve just publicly released an LibreOffice multi-platform, OS independent LibreOffice BASE/Writer application. I developed it using LO Version: 4.4.6.3 and OSX 10.10.5. With the exception of OSX 10.11(theres an outstanding bug report) it runs on all Windows, OSX & Linux/Ubuntu systems very well.

However it fell over when my first US user tried to run it because my development platform defaults to a Locale setting of English (UK) and a Date acceptance pattern of D/M/Y;D/M;D-M. The application failed when it was attempting to coerce a a string field that was “19/01/2016” using the Cdate function to a date. I’m assuming that his system defaulted to the US Date acceptance pattern of M/D/Y;M/D;M-D and that’s why it failed.

My questions is

How can I retrieve (using a macro) the local date acceptance pattern & locale setting? So that I might be able to prevent this happening.

And does anyone have any advice for handling dates information e.g. date last modified dates of files, sorting records asc. & desc. by date, best format to hold date information in a database so that I can cope with any local date format preference.

Second question:

Can I, via a macro, re-set the date acceptance pattern to the ISO standard date format YYYY/MM/DD and do you think this would be acceptable (it would certainly be a lot less confusing) ?

I realised I don’t need to retrieve the locale date setting; there’s an easier (if not very elegant) way. I’ve found a simple answer to the problem with this (what I’ve termed) tripwire code:

dim testDate    as date
testDate=cDate("21/01/16")

On a UK system this statement will work because the default date format is D/M/Y
On a US system this statement will fail because the default date format is M/D/Y

I have discovered that the ‘problem’ with dates ONLY appears when you attempt to coerce a date with cDate or you input a date in an unacceptable format. Internally dates are held as a decimal number and when displayed, unless reformatted, will default to whatever the default format is.

BTW: I rejected a universal solution which would be to insist that all users adopt the ISO standard. I don’t think this is a realistic approach. My attitude to systems design is that the system should adapt to the user and not the other way around.

This is a partial answer. What is appropriate is something you will need to determine for yourself and your customers. In XLocaleData4 there is a public member function to get date acceptance patterns. API page here. Perhaps this is what you are looking for? If not, I would advise asking the developers.

Thank you
I don’t know how to access/code the macro to access XLOCALDATA4 to get the date acceptance patterns. Can anyone help please?