I have a date variable like 10-25-1998 and I only want to echo 10. Can anyone help me about it? Thanks…
$dateString=date("m-d-Y", mktime(0,0,0,10,25,1998));
echo date('m', $dateString); // not working here....will print out 01
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.
strtotime will not recognize “m-d-Y” format, so the only way to get the month out of that string is to just parse it yourself, knowing that it’s the first value in your string: