MySQL DATE_FORMAT 重复说明符

标签 mysql date-format

有人可以解释一下 difference between the %h and %I ?两者都被描述为“小时 (01..12)” 并且与秒 %s%S 相同?这背后有什么“奇怪”的功能吗?复制它的原因是什么?

最佳答案

%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(我能找到的最旧的源存档)中,它们也是相同的。

关于MySQL DATE_FORMAT 重复说明符,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23048587/

相关文章:

ios:如何更改日期选择器显示格式?

java - Java 公历日历和日期格式

java - 使用 simpleDateFormat 将字符串转换为 Util Date 不起作用

java - 在安卓上崩溃

mysql - 如何将unicode字符设置到数据库

php - 在 Codeigniter 上创建权限而不检查 URI 段

mysql - Orientdb GC overhead limit exceeded/out of memory 错误和性能低下

Java时间解析 "Jun 26th 2021, 04:30:15 pm NY"

python - 将excel导入mysql使用python并转换日期戳

php - 如何检测我的搜索引擎上的精确搜索