Written by James McDonald

March 26, 2016

By default the Locale for CakePHP 3 is en_US so dates display as m/d/y

# config/app.php

'App' => [
        'namespace' => 'App',
        'encoding' => env('APP_ENCODING', 'UTF-8'),
        'defaultLocale' => env('APP_DEFAULT_LOCALE', 'en_US'),
        'base' => false,

Which makes dates come out like this:

articles

But I live in the land down under where women glow and men plunder. So I would like my dates to be correctly backwards as they should be. (d/m/y)

'App' => [
        'namespace' => 'App',
        'encoding' => env('APP_ENCODING', 'UTF-8'),
        'defaultLocale' => env('APP_DEFAULT_LOCALE', 'en_AU'),
        'base' => false,

articles_2

 

2 Comments

  1. gerry

    works thanks for that, took ages to find out why the dates were formated strange.

    Reply
    • James Mcdonald

      Glad I could help. I was getting really annoyed having the replace every date with an echo $this->Time->format($time_here, ‘d/m/y’); statement could have saved a lot of a mucking around.

      Reply

Submit a Comment

Your email address will not be published. Required fields are marked *

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

The reCAPTCHA verification period has expired. Please reload the page.

You May Also Like…

Squarespace Image Export

To gain continued access to your Squarespace website images after cancelling your subscription you have several...

MySQL 8.x GRANT ALL STATEMENT

-- CREATE CREATE USER 'tgnrestoreuser'@'localhost' IDENTIFIED BY 'AppleSauceLoveBird2024'; GRANT ALL PRIVILEGES ON...

Exetel Opt-Out of CGNAT

If your port forwards and inbound and/or outbound site-to-site VPN's have failed when switching to Exetel due to their...