Date format in Informix

Peter.Fox picture Peter.Fox · Dec 15, 2017 · Viewed 11.2k times · Source

Is it possible to print the date in the below format in Informix DB,

May 19 1993 12:00AM ?

Consider the below eg.,

If I shoot the below query,

select sysdate from systables;

It displays as,

2017-12-15 05:00:47.24318

But I want the output to be printed as,

Dec 15 2017 05:00AM

Answer

ceinmart picture ceinmart · Dec 15, 2017

References on IBM Informix on-line manuals:
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