Skip to content
Advertisement

Is it possible to remove milliseconds from TO_TIMESTAMP function

I have this query

SELECT ORDER_DATE, MIN(TO_TIMESTAMP(START_TIME,'MM/DD/YYYY HH:MI:SS:AM'))

which gives me this output

16-AUG-19 08.09.51.000000000 AM

its fine except for .000000000 part. I dont need that part, and im not sure how its coming up if its HH:MI:SS format

this is for oracle sql developer.

Advertisement

Answer

Why not just convert to a date? That datatype doesn’t have fractions of a second:

SELECT ORDER_DATE, MIN(TO_DATE(START_TIME, 'MM/DD/YYYY HH:MI:SS:AM'))
User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement