I am having date as 0/0/0000 10:23:56 AM
in a column.
I have tried with TO_CHAR(column_dt,'hh24:mm:ss')
and TO_CHAR(column_dt,'hh:mm:ss pm')
, but both are returning 00:00:00
and 00:00:00 00
respectively.
Can any one please help me out ?
I am having date as 0/0/0000 10:23:56 AM
in a column.
I have tried with TO_CHAR(column_dt,'hh24:mm:ss')
and TO_CHAR(column_dt,'hh:mm:ss pm')
, but both are returning 00:00:00
and 00:00:00 00
respectively.
Can any one please help me out ?
The "date" 0/0/0000 10:23:56 AM
is not a valid date (minimum day and month is 01 and year must be different from 0) so i'm guessing that the column is varchar. If you want to extract the time from that string you can use something like this:
select SUBSTR('0/0/0000 10:23:56 AM', 10, 8) time,
SUBSTR('0/0/0000 10:23:56 AM', 10, 2) hh,
SUBSTR('0/0/0000 10:23:56 AM', 13, 2) MI,
SUBSTR('0/0/0000 10:23:56 AM', 16, 2) ss
FROM DUAL
Use like this :
SELECT CONVERT(VARCHAR(20), Yourdatecolumn, 114)