Date filter wrong. Magento always converts the start/end date in a wrong format (UTC)Filter the back-end...

Why don't hotels mount air conditioning units outside the rooms?

In Linux what happens if 1000 files in a directory are moved to another location while another 300 files were added to the source directory?

Does Skippy chunky peanut butter contain trans fat?

Can we harness gravitational potential energy?

Can a hotel cancel a confirmed reservation?

Gear reduction on large turbofans

How to deal with an incendiary email that was recalled

How does Leonard in "Memento" remember reading and writing?

Is using an 'empty' metaphor considered bad style?

Is there a weight limit to Feather Fall?

Consequences of lack of rigour

How would an AI self awareness kill switch work?

What is the use of 'de' preposition in 'Yo voy *de* compras todos los sábados'

Is it possible to grant users sftp access without shell access? If yes, how is it implemented?

Should I reinstall Linux when changing the laptop's CPU?

Quickly creating a sparse array

How do you funnel food off a cutting board?

Why is working on the same position for more than 15 years not a red flag?

What is the purpose of easy combat scenarios that don't need resource expenditure?

How can I get my players to come to the game session after agreeing to a date?

Play Zip, Zap, Zop

What are the exceptions to Natural Selection?

Is a new Boolean field better than a null reference when a value can be meaningfully absent?

Citing paywalled articles accessed via illegal web sharing



Date filter wrong. Magento always converts the start/end date in a wrong format (UTC)


Filter the back-end products by categoryAdmin form save date format, month and day wrong way aroundShow product only within a date range (between start date and end date)Change Magento Calendar date formatAdminhtml form date input type default format wrongDate format in the customer account dashboardHow to change date format of magento 2 admin grid filter without using ui component?Magento 2: Filter Field with Date IssueMagento 2.1 How to change member birthday date formatMagento 2.2.3 How to adjust date format?













0















If I pull up a sales report and filter shipped by 6/1/16 - 6/30/16 I get a weird result (doesn't match a 3rd party report). When I inspect the final sql query Magento sends to the database I noticed wrong dates:




2016-06-01 04:00:00' AND sfo.created_at <= '2016-06-30 04:00:00




but actually I was expecting




2016-06-01 00:00:00' AND sfo.created_at <= '2016-06-30 23:59:59




Debugging turned out this happens because Magento is calculating the dates on base of UTC time:



Mage_Core_Model_Locale -> const DEFAULT_TIMEZONE  = 'UTC';


This happens twice actually:



Mage_Adminhtml_Block_Widget_Grid_Column_Filter_Date::_convertDate()
Mage_Reports_Model_Resource_Report_Collection::timeShift()


Why is Magento converting the date filter in a wrong format? Since its a constant value I can't have anything configured wrong in backend.



Anyone an idea? As always: Thanks!










share|improve this question














bumped to the homepage by Community 4 mins ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.




















    0















    If I pull up a sales report and filter shipped by 6/1/16 - 6/30/16 I get a weird result (doesn't match a 3rd party report). When I inspect the final sql query Magento sends to the database I noticed wrong dates:




    2016-06-01 04:00:00' AND sfo.created_at <= '2016-06-30 04:00:00




    but actually I was expecting




    2016-06-01 00:00:00' AND sfo.created_at <= '2016-06-30 23:59:59




    Debugging turned out this happens because Magento is calculating the dates on base of UTC time:



    Mage_Core_Model_Locale -> const DEFAULT_TIMEZONE  = 'UTC';


    This happens twice actually:



    Mage_Adminhtml_Block_Widget_Grid_Column_Filter_Date::_convertDate()
    Mage_Reports_Model_Resource_Report_Collection::timeShift()


    Why is Magento converting the date filter in a wrong format? Since its a constant value I can't have anything configured wrong in backend.



    Anyone an idea? As always: Thanks!










    share|improve this question














    bumped to the homepage by Community 4 mins ago


    This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.


















      0












      0








      0


      1






      If I pull up a sales report and filter shipped by 6/1/16 - 6/30/16 I get a weird result (doesn't match a 3rd party report). When I inspect the final sql query Magento sends to the database I noticed wrong dates:




      2016-06-01 04:00:00' AND sfo.created_at <= '2016-06-30 04:00:00




      but actually I was expecting




      2016-06-01 00:00:00' AND sfo.created_at <= '2016-06-30 23:59:59




      Debugging turned out this happens because Magento is calculating the dates on base of UTC time:



      Mage_Core_Model_Locale -> const DEFAULT_TIMEZONE  = 'UTC';


      This happens twice actually:



      Mage_Adminhtml_Block_Widget_Grid_Column_Filter_Date::_convertDate()
      Mage_Reports_Model_Resource_Report_Collection::timeShift()


      Why is Magento converting the date filter in a wrong format? Since its a constant value I can't have anything configured wrong in backend.



      Anyone an idea? As always: Thanks!










      share|improve this question














      If I pull up a sales report and filter shipped by 6/1/16 - 6/30/16 I get a weird result (doesn't match a 3rd party report). When I inspect the final sql query Magento sends to the database I noticed wrong dates:




      2016-06-01 04:00:00' AND sfo.created_at <= '2016-06-30 04:00:00




      but actually I was expecting




      2016-06-01 00:00:00' AND sfo.created_at <= '2016-06-30 23:59:59




      Debugging turned out this happens because Magento is calculating the dates on base of UTC time:



      Mage_Core_Model_Locale -> const DEFAULT_TIMEZONE  = 'UTC';


      This happens twice actually:



      Mage_Adminhtml_Block_Widget_Grid_Column_Filter_Date::_convertDate()
      Mage_Reports_Model_Resource_Report_Collection::timeShift()


      Why is Magento converting the date filter in a wrong format? Since its a constant value I can't have anything configured wrong in backend.



      Anyone an idea? As always: Thanks!







      grid filter reports date






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Oct 5 '16 at 13:44









      StefanStefan

      1,07111636




      1,07111636





      bumped to the homepage by Community 4 mins ago


      This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.







      bumped to the homepage by Community 4 mins ago


      This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
























          2 Answers
          2






          active

          oldest

          votes


















          0














          In the grid you can set the column type as: datetime instead of date as I think you have now.






          share|improve this answer
























          • Welcome on Magento SE. We encourage developed answers instead of one-liners. Please try and enhance your answer and give a bit more details.

            – Julien Lachal
            Dec 6 '16 at 14:52



















          0














          Use the following code before the generating report, this will most probably solve the problem.



          date_default_timezone_set(Mage::getStoreConfig('general/locale/timezone'));





          share|improve this answer























            Your Answer








            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "479"
            };
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function() {
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled) {
            StackExchange.using("snippets", function() {
            createEditor();
            });
            }
            else {
            createEditor();
            }
            });

            function createEditor() {
            StackExchange.prepareEditor({
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: false,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: null,
            bindNavPrevention: true,
            postfix: "",
            imageUploader: {
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            },
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            });


            }
            });














            draft saved

            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f139517%2fdate-filter-wrong-magento-always-converts-the-start-end-date-in-a-wrong-format%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            2 Answers
            2






            active

            oldest

            votes








            2 Answers
            2






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            0














            In the grid you can set the column type as: datetime instead of date as I think you have now.






            share|improve this answer
























            • Welcome on Magento SE. We encourage developed answers instead of one-liners. Please try and enhance your answer and give a bit more details.

              – Julien Lachal
              Dec 6 '16 at 14:52
















            0














            In the grid you can set the column type as: datetime instead of date as I think you have now.






            share|improve this answer
























            • Welcome on Magento SE. We encourage developed answers instead of one-liners. Please try and enhance your answer and give a bit more details.

              – Julien Lachal
              Dec 6 '16 at 14:52














            0












            0








            0







            In the grid you can set the column type as: datetime instead of date as I think you have now.






            share|improve this answer













            In the grid you can set the column type as: datetime instead of date as I think you have now.







            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Dec 6 '16 at 14:33









            user47952user47952

            1




            1













            • Welcome on Magento SE. We encourage developed answers instead of one-liners. Please try and enhance your answer and give a bit more details.

              – Julien Lachal
              Dec 6 '16 at 14:52



















            • Welcome on Magento SE. We encourage developed answers instead of one-liners. Please try and enhance your answer and give a bit more details.

              – Julien Lachal
              Dec 6 '16 at 14:52

















            Welcome on Magento SE. We encourage developed answers instead of one-liners. Please try and enhance your answer and give a bit more details.

            – Julien Lachal
            Dec 6 '16 at 14:52





            Welcome on Magento SE. We encourage developed answers instead of one-liners. Please try and enhance your answer and give a bit more details.

            – Julien Lachal
            Dec 6 '16 at 14:52













            0














            Use the following code before the generating report, this will most probably solve the problem.



            date_default_timezone_set(Mage::getStoreConfig('general/locale/timezone'));





            share|improve this answer




























              0














              Use the following code before the generating report, this will most probably solve the problem.



              date_default_timezone_set(Mage::getStoreConfig('general/locale/timezone'));





              share|improve this answer


























                0












                0








                0







                Use the following code before the generating report, this will most probably solve the problem.



                date_default_timezone_set(Mage::getStoreConfig('general/locale/timezone'));





                share|improve this answer













                Use the following code before the generating report, this will most probably solve the problem.



                date_default_timezone_set(Mage::getStoreConfig('general/locale/timezone'));






                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Feb 21 '17 at 18:40









                HarisHaris

                54611024




                54611024






























                    draft saved

                    draft discarded




















































                    Thanks for contributing an answer to Magento Stack Exchange!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f139517%2fdate-filter-wrong-magento-always-converts-the-start-end-date-in-a-wrong-format%23new-answer', 'question_page');
                    }
                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    “%fieldName is a required field.”, in Magento2 REST API Call for GET Method Type The Next...

                    How to change City field to a dropdown in Checkout step Magento 2Magento 2 : How to change UI field(s)...

                    夢乃愛華...