Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
249 views
in Technique[技术] by (71.8m points)

Casting dates on denodo oracle database gives a different formatting

I have a date column and I am trying to cast this into a view with a code below but the output does not match the requirement. I use denodo and oracle 18g as my database.

Column

  A 

1-Dec-20
12-Dec-20
11-Dec-20

Expected output

  A 

1-Dec-20
12-Dec-20
11-Dec-20

output I am getting after running the code below.

select 
to_localdate('dd-MM-yyyy', substring(replace("A", 'NULL', ''), 0, 10)) AS A from "xxtable"

   A
0020-12-01
0020-12-12
0020-12-11
question from:https://stackoverflow.com/questions/65935422/casting-dates-on-denodo-oracle-database-gives-a-different-formatting

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

I was able to solve this by using yy instead of yyyy format.

to_localdate('dd-MM-yy', substring(replace("A", 'NULL', ''), 0, 10)) AS A from "xxtable"

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...