Skip to content

not able to use trunc() in a timestamp column #34903

Answered by TB-HunBoka
eponcede asked this question in Q&A
Discussion options

You must be logged in to vote

I was wrong. The formatting is based on JDBC type.
The jdbc driver will map date as timestamp because the oracle date type has time values in it while JDBC date doesn't. So you will lose the time part of the date while transforming it. You can force to hide it, but be careful with it.

You can change it here:

Enabling this setting will result in the following:
select creation_date, trunc(creation_date) truncated, to_date(trunc(CREATION_DATE), 'DD-MM-YY') to_date_and_truncated, cast(CREATION_DATE AS DATE) casted, sysdate, cast(SYSDATE AS TIMESTAMP) from table

You can see that the sysdate value returns an oracle date type, therefore you will not see the time value on it unless you change i…

Replies: 2 comments 3 replies

Comment options

You must be logged in to vote
1 reply
@TB-HunBoka
Comment options

Answer selected by eponcede
Comment options

You must be logged in to vote
2 replies
@TB-HunBoka
Comment options

@eponcede
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants