|
蓝森林 http://www.lslnet.com 2006年8月26日 15:18
“19:00”赋值给TIME属性列结果如何?
我试了一下,mysql会认为是19:00:00,而我看一个文档怎么说会被认成"00:19:00"? |
“19:00”赋值给TIME属性列结果如何?
下次不要看那个文档了 :)
或者你再仔细看看那个文档,确认是他写错了还是你看错了 |
“19:00”赋值给TIME属性列结果如何?
晏子翻译的Mysql中文手册里说(针对MySQL 3.23.7alpla):
7.3.6.3 TIME类型
将“短的”TIME值赋值给一个TIME行列是要格外小心。MySQL使用最右位代表秒的假设来解释值。(MySQL将TIME值解释为经过的时间,而非作为一天的时间 )例如,你可能想到'11:12'、'1112'和1112意味着'11:12:00'(11点12分),但是MySQL解释他们为'00:11:12'(11分12秒)。同样,'12'和12被解释为'00:00:12'。
而原版的英文手册说(for Mysql 4.0.5):
Be careful about assigning ``short'' TIME values to a TIME column. Without colons, MySQL interprets values using the assumption that the rightmost digits represent seconds. (MySQL interprets TIME values as elapsed time rather than as time of day.) For example, you might think of '1112' and 1112 as meaning '11:12:00' (12 minutes after 11 o'clock), but MySQL interprets them as '00:11:12' (11 minutes, 12 seconds). Similarly, '12' and 12 are interpreted as '00:00:12'. TIME values with colons, by contrast, are always treated as time of the day. That is '11:12' will mean '11:12:00', not '00:11:12'.
看来,那个中文手册误导了我:(
我装的mysql是3.23.53,难道是版本的区别?不会吧...... |
“19:00”赋值给TIME属性列结果如何?
按照你贴的内容,翻译有错 :)
...you might think of '1112' and 1112 as meaning...
~~~~这里是1112哦,可不是11:12
你可能想到'11:12'、'1112'和1112意味着
~~~~~这里变成11:12了
原版手册里可每提到'11:12'会变成'00:11:12',事实上那段文字最后一句如下:
That is '11:12' will mean '11:12:00', not '00:11:12'.
说的就是'11:12'会被当做'11:12:00' |
| |