TomJava
TomJava

Reputation: 529

TO_CHAR from Date data type output difference

select CREATED_DATE,to_char(CREATED_DATE, 'YYYY-MM-DD HH24:MM') CREATED_DATE_2 from MY_TABLE;

CREATED_DATE            CREATED_DATE_2 
4/20/2020 1:44:57 AM    2020-04-20 01:04
4/20/2020 6:45:55 AM    2020-04-20 06:04
4/21/2020 5:32:57 AM    2020-04-21 05:04
4/21/2020 5:33:45 AM    2020-04-21 05:04

Not sure why I see this big difference when using to_char function

Upvotes: 0

Views: 26

Answers (1)

psaraj12
psaraj12

Reputation: 5072

You are using the format of month MM instead of Minutes MI ,Please use the below

  select CREATED_DATE,to_char(CREATED_DATE, 'YYYY-MM-DD HH24:MI') CREATED_DATE_2 from MY_TABLE;

Upvotes: 1

Related Questions