0

i have a problem with time zone , when i make an order , the time for this command ('created_at') is not the local time , it returns the UTC time and not local time

so for that i find the solution here magento 2 - getCreatedAt() returns UTC time and not local time

but in my case i am working with the function addColumn() to display the date

can anyone help me to implement that in my case

$this->addColumn('m_created_at', array(
            'header'       => __('Date :'),
            'index'        => 'm_created_at',
            'type'         => 'm_datetime',
            'filter_index' => 'main_table.created_at',
        ));

my local variables :

'locale' => [
                    'firstday' => '0',
                    'weekend' => '0,6',
                    'datetime_format_long' => '%A, %B %e %Y [%I:%M %p]',
                    'datetime_format_medium' => '%a, %b %e %Y [%I:%M %p]',
                    'datetime_format_short' => '%m/%d/%y [%I:%M %p]',
                    'date_format_long' => '%A, %B %e %Y',
                    'date_format_medium' => '%a, %b %e %Y',
                    'date_format_short' => '%m/%d/%y',
                    'language' => 'en',
                    'code' => 'fr_FR',
                    'timezone' => 'Europe/Paris',
                    'weight_unit' => 'kgs',
                ],

1 Answer 1

0

Check This

this->addColumn(
        'm_created_at',
        [
            'header' => __('Date'),
            'index' => 'm_created_at',
            'type'      => 'date',
            'filter_index' => 'main_table.created_at',
        ]
    );

Time Zone Problem:

Go to Configuration > General > locale Options > Time Zone

Set the Server time zone and Magento Time zone the same for this Problem.

3
  • thank you brother for the response , i tried the above code it didn't work Commented May 27, 2020 at 15:36
  • try to check the above configuration of time zone
    – Devidas
    Commented May 27, 2020 at 15:37
  • Can you check please the code above, i have updated my question @Devidas Commented May 27, 2020 at 16:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.