PHP date conversion to strtotime

后端 未结 2 2052
孤城傲影
孤城傲影 2020-12-02 03:07

I have an array where each record has a \'date\' field. The dates are in this format: \'10/09/2015\'. When I use strtotime

2条回答
  •  情深已故
    2020-12-02 03:50

    You need to understand over here the date format of your date. Here m/d/Y is considered to be the standard American Date format.

    So when your date is like

    '09/06/2014',//it should be considered as 06 september 2014
    '04/07/2014',//it should be considered as 07 april 2014
    

    And when your date is like as

    '21/05/2014',
    '22/05/2014',
    

    Then the above date doesn't fits within the standards of American Date Format i.e. m/d/Y instead what you can do over here is replace / along with - which converts your date into European Date Format which is d-m-Y

提交回复
热议问题