I am new to PHP and cannot figure out the best method to convert two strings I have from URL params.
I would like to convert:
“August 2010” to —> “2010-08-%”
and also:
“2010” to —> “2010-%-%”
Thank you in advance!
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You can use the
strtotimefunction withdate:Just adjust the format parameter to the
datefunction to get the result in the format you are looking for. You might want to append the%part after convert the date format.