You can either put it on a timestamp without fractional seconds (this will be rounded to the nearest second):
CAST( your_timestamp AS TIMESTAMP(0) )
Or to the DATE data type (this will be truncated to the nearest second):
CAST( your_timestamp AS DATE )
If you want it to be like a TIMESTAMP(0) data TIMESTAMP(0) , then discard it:
CAST( CAST( your_timestamp AS DATE ) AS TIMESTAMP(0) )
Or you can convert it to a formatted string and specify the format model you want to use (this will be truncated to the nearest second):
TO_CHAR( your_timestamp, 'YYYY-MM-DD HH24:MI:SS' )
Like this:
SQL Fiddle
Oracle 11g R2 schema setup :
CREATE TABLE your_table ( your_timestamp ) AS SELECT TIMESTAMP '2017-10-25 12:53:12.10076' FROM DUAL;
Request 1 :
SELECT CAST( your_timestamp AS TIMESTAMP(0) ) AS "Timestamp", CAST( your_timestamp AS DATE ) AS "Date", TO_CHAR( your_timestamp, 'DD-MM-YYYY HH24:MI:SS' ) AS "String" FROM your_table
Results :
| Timestamp | Date | String | |-----------------------|----------------------|---------------------| | 2017-10-25 12:53:12.0 | 2017-10-25T12:53:12Z | 25-10-2017 12:53:12 |
Note. How the TIMESTAMP and DATE output are formatted depends on the NLS_TIMESTAMP_FORMAT and NLS_DATE_FORMAT session parameters, but you can directly control the TO_CHAR formatting when specifying the format model.
source share