Wednesday, May 1, 2013

Convert Minutes to Date/Timestamp in oracle

 Convert Minutes to Date in oracle

            If user has number between 00 to 59,That number can be converted to timestamp .

Syntax:
           to_timestamp(minutes,fmt)  
        



SQL> select to_timestamp('00','mi') from dual;

to_timestamp('00','mi')
-------------------------------------------------
01-MAY-14 00.00.00.000000000 PM
It has current date, time specified in the format.
SQL> select to_timestamp('59','mi') from dual;

to_timestamp('59','mi')
-----------------------------------------------
01-MAY-13 00.59.00.000000000 AM




If minutes is not between 00 and 59
  following error message will be displayed.


ERROR at line 1:
ORA-01851: minutes must be between 0 and 59

Tags: Convert minutes     to date/timestamp,convert minutes     to Date/timestamp using To_timestamp function,oracle convert minutes     to date ,oracle convert minutes     to date/timestamp using to_date,oracle convert minutes     to current minutes    date/timestamp.

No comments:

Post a Comment