Home » SQL & PL/SQL » SQL & PL/SQL » how i can get the day from date
how i can get the day from date [message #253098] Sun, 22 July 2007 08:54 Go to next message
hussienburhan
Messages: 28
Registered: July 2007
Junior Member
hi
how i can get day from date for example this date 12/12/2007

how i can get the day that is 12

thanks
Re: how i can get the day from date [message #253100 is a reply to message #253098] Sun, 22 July 2007 09:12 Go to previous message
Littlefoot
Messages: 20901
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Something like this: use the TO_CHAR function (TO_DATE is here just to convert input string 12/12/2007 to a date - you'd omit it if there was a COLUMN value you'd like to check).
SQL> select to_char(to_date('12/12/2007', 'dd/mm/yyyy'), 'dd') day from dual;

DA
--
12

SQL> create table test (col date);

Table created.

SQL> insert into test values (to_date('12/12/2007', 'dd.mm.yyyy'));

1 row created.

SQL> select to_char(col, 'dd') from test;

TO
--
12

SQL>
Previous Topic: LAST_INSERT_ID() ?
Next Topic: problem is getting result .. I am a lazy SOB!
Goto Forum:
  


Current Time: Fri Dec 09 17:47:49 CST 2016

Total time taken to generate the page: 0.45026 seconds