【问题标题】:Date format in InformixInformix 中的日期格式
【发布时间】:2018-05-29 12:31:57
【问题描述】:

是否可以在Informix DB中以以下格式打印date

May 19 1993 12:00AM?

考虑下面的例子,

如果我拍摄下面的查询,

select sysdate from systables;

它显示为,

2017-12-15 05:00:47.24318

但我希望输出打印为,

Dec 15 2017 05:00AM

【问题讨论】:

  • 你不能使用to_date函数吗?

标签: sql informix to-date str-to-date string-to-datetime


【解决方案1】:

IBM Informix 在线手册参考:
TO_CHAR function here
GL_DATETIME here

select sysdate 
     , to_char(sysdate, '%b %d %Y %R') as _24h
     , to_char(sysdate, '%b %d %Y %I:%M%p') as _12h
from sysmaster:sysdual;


(expression)               _24h                                                _12h                                                
-----------------------------------------------------------------------------------------------------------------------------------
2017-12-15 07:47:04.0      Dec 15 2017 07:47                                   Dec 15 2017 07:47AM                                 

【讨论】:

    猜你喜欢
    • 2010-11-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-06-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多