Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个表格,可以在数据库中保存出生日期。此表单将三个变量传递给 php: $ayear $amonth $adate 现在我需要将这些变量以以下格式保存在数据库中:00/00/0000(或 00/00/00,如果不支持 00/00/0000) . 我需要创建一个 date() 变量,但我不知道如何。互联网上的所有示例都使用 time() 或 now() 这对我来说没有用。有人可以给我正确的功能吗?感谢您的时间!
如果您使用的是 MySQL,您需要将YYYY-MM-DD字段类型设置为 date。我会将此变量值保存到数据库中。
YYYY-MM-DD
$birthday = implode('-', array($year, $month, $day));