Use 24-hour clock format

SoftTimur

Member
Hello,

At the moment, I set my customer timezone: (GMT-00:00) UTC. And the language is English. The time is displayed as follows. It seems that the format is the 12-hour clock format with the AM/PM specifier.

Is it possible to set up to use 24-hour clock format? With or without AM/PM specifier does not matter.

Thank you

Screenshot 2023-10-17 at 20.48.48.png
 
Throughout the app, the format is given by the language locale, more specifically, the short format, as you noted.

Changing this into the long format should be done by overwriting the application format component, which is easy enough.
In apps/common/config/main-custom.php after the 'db' component, add the 'format' component, see the START and END markers:
PHP:
<?php declare(strict_types=1);
if (!defined('MW_PATH')) {
    exit('No direct script access allowed');
}

/**
 * Custom application main configuration file
 *
 * This file can be used to overload config/components/etc
 *
 * @package MailWizz EMA
 * @author MailWizz Development Team <support@mailwizz.com>
 * @link https://www.mailwizz.com/
 * @copyright MailWizz EMA (https://www.mailwizz.com)
 * @license https://www.mailwizz.com/license/
 * @since 1.1
 */

return [

    // application components
    'components' => [
        'db' => [
            'connectionString'  => 'mysql:host=mailwizz-v2-mysql;dbname=mailwizz-v2',
            'username'          => 'mailwizz-v2',
            'password'          => 'mailwizz-v2',
            'tablePrefix'       => 'mw_',
        ],
        // START formatter override
        'format' => [
            'class' => 'system.utils.CLocalizedFormatter',
            'dateFormat' => 'long',
        ],
        // END formatter
    ],

    // params
    'params' => [
        'email.custom.header.prefix' => 'X-',
    ],
];
See https://www.yiiframework.com/doc/api/1.1/CLocalizedFormatter for more info.
 
Back
Top