开发者

php timestamp function needed [duplicate]

This question already has an answer here: Closed 11 years ago.

开发者_高级运维Possible Duplicate:

Formatting a timestamp

I require a php function that returns the date in the format in the same format as mySQL function CURRENT_TIMESTAMP (i.e like this--> 2011-08-10 17:17:23).

Wondering if there's anything available


echo date("Y-m-d H:i:s");

will do the job.


You can use the date() function for this.

// example result 2010-08-12 22:30:45
$mysqlTime = date ("Y-m-d H:i:s");

Also if you want to get a MySQL date as a timestamp for use in php functions you can use MySQL's UNIX_TIMESTAMP function

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜