Answer the question
In order to leave comments, you need to log in
How to convert date format?
I have such a question, you can of course use a regular expression to separate everything through problems. I just think maybe there is a method that can easily convert all this to a date in the correct format. The following form of date comes to the server And the following date 'format' => 'D d M yyyy'
is obtained 'Fri 9 Mar 2018'
Answer the question
In order to leave comments, you need to log in
I just think maybe there is a method that can easily convert all this to a date in the correct format.
In general, you need to choose a date format that will be processed normally by both JS and PHP. Try to cast the string 'Fri 9 Mar 2018' to 'Fri 9 Mar 2018' (an extra space before the nine) and feed the strptime() functions with the format '%a %e %b %Y'.
array(9) {
["tm_sec"]=>
int(0)
["tm_min"]=>
int(0)
["tm_hour"]=>
int(0)
["tm_mday"]=>
int(9)
["tm_mon"]=>
int(2)
["tm_year"]=>
int(118)
["tm_wday"]=>
int(5)
["tm_yday"]=>
int(67)
["unparsed"]=>
string(0) ""
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question