help please with wrong linux date format

Anyone know how i specify the date format for date.shortdate?

I believed it was supposed to be the system date format of the server, but its not.
i know the server (locale) is using en_GB.UTF-8 but i seem to be getting US.

its a CGI running on Ubuntu server 14.04 LTS 64bit

I don’t believe there is a way to specify the format - it is supposed to return the server format, as you said. Perhaps there is en environment issue… maybe the CGI environment is different from your user settings, for instance.

You may need to create your own method for returning the date format you want - or if you are comfortable server-side, troubleshoot for possible CGI environment issues.

ah! turns out the etc/init.d/apache2 script specifically sets the LANG=C which has the effect of turning off locales.

I wonder if it can be configured in the Xojo perl script rather than change apache, which will also affect other sites?

i guess only Xojo will know that though.

Hi @Greg O’Lone is there any official word on this? Or unofficial ideas :wink:

You may want to build your own. There seems to be no way to set the locale, even in the new framework.

two years ago I ran into this and suggested to give us the chance to override any system or webserver locale settings.

a declare into the C runtime library would let you alter it
in C set locale is like

char* setlocale (int category, const char* locale);

the categories are defined as

#define LC_ALL_MASK ( LC_COLLATE_MASK \\ | LC_CTYPE_MASK \\ | LC_MESSAGES_MASK \\ | LC_MONETARY_MASK \\ | LC_NUMERIC_MASK \\ | LC_TIME_MASK ) #define LC_COLLATE_MASK (1 << 0) #define LC_CTYPE_MASK (1 << 1) #define LC_MESSAGES_MASK (1 << 2) #define LC_MONETARY_MASK (1 << 3) #define LC_NUMERIC_MASK (1 << 4) #define LC_TIME_MASK (1 << 5)

Or in xojo

const LC_COLLATE_MASK = 1 const LC_CTYPE_MASK = 2 const LC_MESSAGES_MASK = 4 const LC_MONETARY_MASK = 8 const LC_NUMERIC_MASK = 16 const LC_TIME_MASK = 32 const LC_ALL_MASK = 63 // all the others OR'd together

so you could try something like

[code] soft declare setlocale lib “LibC” ( catgeory as integer, locale as string) as Ptr

call setLocale(LC_ALL_MASK, ... whatever the OPERATING SYSTEM USES FOR LOCALE CODES you want )


OR you could just use the NEW framework & its dates which allow you to specify the locale :stuck_out_tongue:

[quote]OR you could just use the NEW framework & its dates which allow you to specify the locale :stuck_out_tongue: [/quote]

now, theres a great idea. i shall have a go at that!