简体   繁体   English

mysql查询的php日期格式

[英]php date format for mysql query

I can't seem to find this answer. 我似乎找不到此答案。

what would be the php code for having date in this following format: 什么是具有以下格式的日期的php代码:
2012-11-29 2012-11-29

$date = new DateTime();
$date = $date->format('F j, Y');

This give me in November 29, 2012 这给了我2012年11月29日

$date = new DateTime();
$date = $date->format('Y-m-d');

http://php.net/manual/en/function.date.php http://php.net/manual/zh/function.date.php

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM