大家帮忙看看出了什么问题

tidus 2003-01-08 08:34:11
echo date("Y-M-d, H:i a","20030108202144");

得出的结果是:2038-Jan-19, 11:14 am 。

20030108202144是从Mysql里取出的Timestamp。
...全文
33 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
tidus 2003-01-13
  • 打赏
  • 举报
回复
timestamp是mysql里面自动设置的。
hhzh426 2003-01-13
  • 打赏
  • 举报
回复
你这个取出的timestamp是自定义的吧。
好象是2003-01-08 20:21:44的一种特殊表示形式。
我这儿有两种标准的时间表示形式
1040355114(精确到秒)
1041901270.058(精确到毫秒)
hhzh426 2003-01-13
  • 打赏
  • 举报
回复
Column type Display format
TIMESTAMP(14) YYYYMMDDHHMMSS
TIMESTAMP(12) YYMMDDHHMMSS
TIMESTAMP(10) YYMMDDHHMM
TIMESTAMP(8) YYYYMMDD
TIMESTAMP(6) YYMMDD
TIMESTAMP(4) YYMM
TIMESTAMP(2) YY
这种格式是mysql自己设置的时间格式,不能用标准的转换函数来转换。
Although TIMESTAMP values are stored to full precision, the only function that operates
directly on the underlying stored value is UNIX_TIMESTAMP(). Other functions operate
on the formatted retrieved value. This means you cannot use functions such as HOUR()
or SECOND() unless the relevant part of the TIMESTAMP value is included in the formatted
value. For example, the HH part of a TIMESTAMP column is not displayed unless the
display size is at least 10, so trying to use HOUR() on shorter TIMESTAMP values produces
a meaningless result.
也就是说只能用select UNIX_TIMESTAMP(字段)这种方法来获取确切的时间值。或者你自己写解析函数。
tidus 2003-01-12
  • 打赏
  • 举报
回复
echo date("Y-M-d, H:i a",mktime(20,21,44,01,08,2003));

出来的结果是:

2002-Dec-31, 20:21 pm
wuxyun 2003-01-10
  • 打赏
  • 举报
回复

echo date("Y-M-d, H:i a",mktime(20,21,44,01,08,2003));
telescope 2003-01-08
  • 打赏
  • 举报
回复
这不是什么问题呀,我认为正常啊
uGain 2003-01-08
  • 打赏
  • 举报
回复
要把20030108202144写成mktime()形式的timestamp

21,886

社区成员

发帖
与我相关
我的任务
社区描述
从PHP安装配置,PHP入门,PHP基础到PHP应用
社区管理员
  • 基础编程社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧