0

in our magento 2 store is see when new orders come in they are not timestamped correcty in the sales pages.

They are all rounded of to hour:08:00 and do not show the real time when the order was placed.

But when i go to the order it self it shows the correct time. is this a magento bug?

Sales page timestamp enter image description here

5

It is a bug of Magento2.

Fixes: You need to change dateFormat from following file. /vendor/magento/module-sales/view/adminhtml/ui_component/sales_order_grid.xml

Replace this line

<item name="dateFormat" xsi:type="string">MMM dd, YYYY, H:MM:SS A</item>

With

<item name="dateFormat" xsi:type="string">MMM dd, YYYY, H:mm:ss A</item>

Note: you need to move file in app/code/Magento/Sales/view/adminhtml/ui_component/sales_order_grid.xml

| improve this answer | |
3

As in Mohammad Rashid Hussain answer, it is a bug in magento 2 core.

One option is to fix it in magento core setup as mentioned in that answer.

Another option is to fix the problem in a custom module or a custom theme, since editing Magento core files is not a good idea.

Magento core files can be overwritten with later updates. You should add the sales module to your own module, module.xml file

<?xml version="1.0"?>
    <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
    <module name="Vendor_YourModule" setup_version="1.1.2" schema_version="1.1.2">
        <sequence>
            <module name="Magento_Sales"/>
        </sequence>
    </module>
</config> 

Then you can create the sales_order_grid.xml file under Vendor/YourModule/view/adminhtml/ui_component/ in your module and add the following code to it

<?xml version="1.0" encoding="UTF-8"?>
    <!--
    /**
     * Copyright © 2013-2017 Magento, Inc. All rights reserved.
     * See COPYING.txt for license details.
     */
    -->
    <listing xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_configuration.xsd">
        <columns name="sales_order_columns">
            <column name="created_at" class="Magento\Ui\Component\Listing\Columns\Date">
                <argument name="data" xsi:type="array">
                    <item name="config" xsi:type="array">
                        <item name="dateFormat" xsi:type="string">MMM dd, YYYY, H:mm:ss A</item>
                    </item>
                </argument>
            </column>
        </columns>
    </listing>

you just have to add the part that you want to edit/overwrite.

Then you should use bin/magento setup:upgrade and bin/magento setup:di:compile.

| improve this answer | |
  • Solution is Perfect. It worked. – Ahmad Vaqas Khan Nov 28 '17 at 12:27
  • Can you confirm please whether this bug is fixed in 2.2.3? The settings mentioned no longer reside in the sales_order_grid.xml file, so I presume that Magento must have addressed this bug. I've noticed that the timestamp on my magento log files is an hour behind, although my server displays accurate information and the Magento timezone is configured properly. – Joshua Flood Jun 4 '18 at 11:19
  • @JoshuaFlood This the link to the bug github.com/magento/magento2/issues/9426, it is planned to be fixed on Magento 2.3 release. I have not tried on 2.2.3 but on recent project with version of 2.1.12 the problem still exist and the solution is valid. – Korbin Jun 29 '18 at 13:25
  • Thanks for the info! Do you know whether the bug affects the server logs as well? Or am I experiencing another problem? THanks – Joshua Flood Jul 13 '18 at 11:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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