I tried below query but its not working
select
TO_TIMESTAMP(ColumnName(Data type Date), 'DD-MON-YYYYHH24:MI:SS.FF')
from TableName
where Changedate>='01-Dec-2015'
*I need the result without AM/PM indication. Result will be 15-DEC-2015 15:16:42.045016
FF'. By default format of TIMESTAMP WITH TIME ZONE is 'YYYY-MM-DD HH24: MI: SS. FF TZH: TZM'. Here TZH is Time Zone Hour and TZM is Time Zone Minute. The digits / length of Fraction of Seconds can be specified from 0 – 9 digits.
Oracle has expanded on the DATE datatype and has given us the TIMESTAMP datatype which stores all the information that the DATE datatype stores, but also includes fractional seconds. If you want to convert a DATE datatype to a TIMESTAMP datatype format, just use the CAST function.
If I got your question right you need the output in the mentioned Format. That would be a conversion to character
select to_char(cast(sysdate as timestamp),'DD-MON-YYYY HH24:MI:SS.FF') from dual
Of course in the above the FF would also always be 000000
But if you have a timestamp variable you would not cast
select to_char(systimestamp,'DD-MON-YYYY HH24:MI:SS.FF') from dual
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With