Hi.

I'm developing a CMS which will be open source. Within it, i am displaying today's date like so:

print date('d-m-Y');

This is OK if you live in the UK, but if you're in the sates, this would make more sense:

print date('Y-m-d');

My question is: Is it possible to have a dynamic format depending on the locale of the user viewing the page?

Regards,
Jon

    It may be best to allow the CMS admin to set a default date format string, then allow users to configure with their own preferences.

      OK - so it's not very easy to do then?

        OK - so it's not very easy to do then?

        Yes, but even it was easy and reliable I would be more concerned with it being rather presumptuous to think that all users from a particular locale will prefer a particular date format.

          For example, in the U.S., the preferred format would appear to be mm/dd/yyyy, rather than the international standard.

            Write a Reply...