I looked in many threads regarding this issue but still can't get to the bottom of this one. Here is my code:
$birthdate_ts = strtotime("$year-$num_month-$day");
$birthdate = date("d/m/Y",$birthdate_ts);
Where $day $num_month and $year are numbers (example 1 10 1990). The result I'm getting is 1/1/1970 every time. I also tried different variations for the "strtotime()" input and still nothing. Where am I wrong?
Your parse format is "d/m/y" and your format you are creating is "Ymd". They need to match. Try this:
$birthdate_ts=strtotime("$year-$num_month-$day");
$birthdate=date("Y-m-d",$birthdate_ts);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.