简体   繁体   中英

A tip on mysql timestamp datatype

Need to know how to deal with a mysql timestamp field .. I mean When I add a new date into PHPMYADMIN .. and the field is timestamp .. it saves a readable date .I find this strange as I know that timestamp is supposed to be integr .It is the integer that represents number of seconds passed since 01-01-1970 till this date .

And if this is logical .. from my php script what shall I send to the database to save in this mysql timestamp field ? Thank you so much

Mysql时间戳格式为YYYY-MM-DD HH:MM:SS。范围从1970-01-01 00:00:01到2038-01-19 03:14:07。要在MySQL中保存unix时间戳,您需要使用INT作为数据类型

TIMESTAMP columns are displayed in the same format as DATETIME columns. In other words, the display width is fixed at 19 characters, and the format is YYYY-MM-DD HH:MM:SS .

Reference: http://dev.mysql.com/doc/refman/4.1/en/timestamp.html

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.

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