Search code examples
phpdateformatlocale

Locale date format in PHP5


my site changes its locale dependent upon either user settings or browser settings (where the user hasn't set their preference). I am using amline charts, the stock chart specifically, which requires the date format in 'MM/DD/YYYY' or 'DD-MM-YYYY', I guess so the chart knows how to understand the dates. There are many ways to format a date dependent upon the computer locale, however I can't find a way to get the locale format (as above).


Solution

  • What's the problem?

    date('m/d/Y')
    

    or

    date('d-m-Y')