Setting date format for Australia

Open to all! Ask other shopowners for help.
Post Reply
frankl
Builder
Posts: 159
Joined: Tue Feb 23, 2021 8:39 pm
Phoenix Version: v1.1.0.4
Has thanked: 17 times
Been thanked: 25 times

Setting date format for Australia

Post by frankl »

I want to display short dates in admin as d/m/Y

In english.php I had

Code: Select all

setlocale(LC_ALL, ['en_AU.UTF-8', 'en_AU.UTF8', 'ena_au']);

$long_date_formatter = new IntlDateFormatter('en', IntlDateFormatter::FULL, IntlDateFormatter::NONE);
$short_date_formatter = new IntlDateFormatter('en', IntlDateFormatter::SHORT, IntlDateFormatter::NONE);
$date_time_formatter = new IntlDateFormatter('en', IntlDateFormatter::SHORT, IntlDateFormatter::LONG);
However short dates (i.e. on admin/customers.php) dates were shown as m/d/y

Changing IntlDateFormatter locale to en_AU fixed it.

Code: Select all

setlocale(LC_ALL, ['en_AU.UTF-8', 'en_AU.UTF8', 'ena_au']);

$long_date_formatter = new IntlDateFormatter('en_AU', IntlDateFormatter::FULL, IntlDateFormatter::NONE);
$short_date_formatter = new IntlDateFormatter('en_AU', IntlDateFormatter::SHORT, IntlDateFormatter::NONE);
$date_time_formatter = new IntlDateFormatter('en_AU', IntlDateFormatter::SHORT, IntlDateFormatter::LONG);
Set in includes/languages/english.php and admin/includes/languages/english.php


Join The Code Co-op to get access to your library in the Code Co-op Forum
heatherbell
Senior Contributor
Posts: 2540
Joined: Mon Oct 07, 2019 4:39 am
Phoenix Version:
Has thanked: 35 times
Been thanked: 243 times

Re: Setting date format for Australia

Post by heatherbell »

MyGamesShop
Contributor
Posts: 131
Joined: Wed Mar 10, 2021 3:02 am
Phoenix Version: v1.1.0.6
Has thanked: 8 times
Been thanked: 5 times

Re: Setting date format for Australia

Post by MyGamesShop »

Moocho grassyass!!! I missed those three lines in some update :)

Now show me how to make the product price in admin always show as:

Products Price (Gross) 100.00 instead of Products Price (Gross) 100
and
Products Price (Net) 100.00 instead of Products Price (Net) 100.0000

I set 'Tax Decimal Places' to 2
Australian Dollar (default) AUD 1.00000000 <--- even when I input 1.00

Its just weird. (and thankyou for making many of your addons free btw..)
frankl
Builder
Posts: 159
Joined: Tue Feb 23, 2021 8:39 pm
Phoenix Version: v1.1.0.4
Has thanked: 17 times
Been thanked: 25 times

Re: Setting date format for Australia

Post by frankl »

MyGamesShop wrote: Tue Jul 15, 2025 4:24 am Moocho grassyass!!! I missed those three lines in some update :)

Now show me how to make the product price in admin always show as:

Products Price (Gross) 100.00 instead of Products Price (Gross) 100
and
Products Price (Net) 100.00 instead of Products Price (Net) 100.0000

I set 'Tax Decimal Places' to 2
Australian Dollar (default) AUD 1.00000000 <--- even when I input 1.00

Its just weird. (and thankyou for making many of your addons free btw..)
The way Net and Gross are calculated doesn't lend itself well to PHP formatting, hence the weirdness. It's possible to program something, but not worth it in my opinion. Just put up with it :)


Join The Code Co-op to get access to your library in the Code Co-op Forum
Post Reply