Categories
How do I convert the date format this 2024-03-07T00:00:00.000+00:00 into 7-Mar-2024 as data datatype

I want to convert the date format this 2024-03-07T00:00:00.000+00:00 into 7-Mar-2024 as when I use trunc() function even then it returns the same and I dont want to convert it into to_char, how is it possible?
Best Answer
-
TO_DATE( SUBSTR( your_column , 1, 10 ), 'YYYY-MM-DD')
2
Answers
-
Are you asking about a Publisher feature or is yours a pure SQL question?
A column of type date, doesn't have a format. The visible format of the date is always a formatting "like a string". There is a default date format mask that is used by the tool you use to view the data.
0 -
HI, I am Asking about pure SQL when ever I tried to convert it the date into specific format it returns complete value with time which I dont want
0 -
Ok, in the future for SQL questions you should consider posting them in https://forums.oracle.com/ords/apexds/domain/dev-community/category/sql_and_pl_sql (it's a separate platform but still a fully Oracle products/services focused forum).
What data type is your source? "date"? The data type is able to have the time component, that's why by default the display mask for a date field generally contains it.
You said at the beginning you don't want to convert it to a piece of text using TO_CHAR(), despite that function being the one allowing to return a date into the required format.
It sounds like there are missing elements here that aren't known...
Where are you trying to get the date to display the way you want? Does it really matter if the date is rendered as a text if that allows you to render it in the required format?
You said you used TRUNC(), and it does work: it does remove the value of the time component setting it to 00:00:00, but your date is technically still having a time component, it just doesn't have the original hours, minutes and seconds but 00:00:00 instead.
That's why I said that all you seem to be after is to display it differently, because you can't really change the date datatype to not have a time component...
0 -
HI @Ayub
BIP default format - canonical format so need to convert refer below for examples -
Can you refer below documentation -
Regards,
Arjun
1