【发布时间】:2014-04-13 21:20:28
【问题描述】:
有人能解释一下difference between the %h and %I吗?两者都被描述为“小时(01..12)”并且与秒%s和%S相同?这背后有什么“奇怪”的功能吗?重复的原因是什么?
【问题讨论】:
标签: mysql date-format
有人能解释一下difference between the %h and %I吗?两者都被描述为“小时(01..12)”并且与秒%s和%S相同?这背后有什么“奇怪”的功能吗?重复的原因是什么?
【问题讨论】:
标签: mysql date-format
%h 和 %I,以及 %s 和 %S 是相同的。
在代码中是这样的:
case 'h':
case 'I':
hours_i= (l_time->hour%24 + 11)%12+1;
length= (uint) (int10_to_str(hours_i, intbuff, 10) - intbuff);
str->append_with_prefill(intbuff, length, 2, '0');
break;
case 'S':
case 's':
sprintf(intbuff,"%02d",l_time.second);
str->append(intbuff);
break;
即使早在 2003 年 6 月 20 日发布的版本 3.23.57(我能找到的最旧的源存档)中,它们也是相同的。
【讨论】: