Home » SQL & PL/SQL » SQL & PL/SQL » Date Format Conversion
Date Format Conversion [message #1877] Thu, 06 June 2002 22:39 Go to next message
Achintya
Messages: 1
Registered: June 2002
Junior Member
I want to convert date in format dd/mm/yyyy to date format mm/yyyy with the restriction that the resultant value is date type.
Re: Date Format Conversion [message #1880 is a reply to message #1877] Fri, 07 June 2002 03:02 Go to previous message
Maaher
Messages: 7065
Registered: December 2001
Senior Member
This is just for display purposes then, because Oracle has its own internal date format (including time indication). You can, however set the NLS date format.
e.g.:
SQL> alter session set nls_date_format = 'MM/YYYY';

Session altered.

SQL> select sysdate from dual;

SYSDATE
-------
06/2002

To compare to dates: wrap a to_date(to_char(date_field,'MM/YYYY'),'MM/YYYY') around your date_fields. The database will lose all info concerning day and time.

MHE
Previous Topic: How to calculate year, month & days between to date's
Next Topic: Re: Can we use PL/SQL key words as Coloumn Names
Goto Forum:
  


Current Time: Tue Apr 16 18:46:26 CDT 2024