我的日期格式有问题,它是从 SQL 数据库获取的值并传递给用户的表单,作为回报,当用户将其设置回存储到数据库中时,格式已经不一样了。
$sql = mysql_query("SELECT * FROM $memberTable WHERE id='11' LIMIT 1"); //checking from SQL
$sqlcheck = mysql_fetch_assoc($sql); //Pass each value
$dob = strftime("%Y-%B-%d", strtotime($sqlcheck['dob']));
//format from databases 2000-10-30 into 2000-October-30
$dob = explode("-", $dob);
// break into day,month,year for form to fill in
$dob = $dob[0].'-'.$dob[1].'-'.$dob[2];
// after user fill in combine together for user to input back to databases
$dob = strftime("%Y-%m-%d", strtotime($dob));
//formatting back into databases format, 2000-October-30 into 2000-10-30
//The main problem here is the output is "2000-10-02"
我想知道为什么 day value pass 变成 02 而不是 30 ?我使用的格式代码有问题吗?请帮忙。