Re: 'date' datatype question

From: Jonathan Gennick <gennick_at_worldnet.att.net>
Date: 1997/12/02
Message-ID: <6600s3$n4d_at_bgtnsc01.worldnet.att.net>#1/1


On 29 Nov 1997 08:44:41 GMT, sevirina_at_aol.com (SEVIRINA) wrote:

>I've got a date datatype. I defined it at 'date' during creation of tables.
>
>Basically, I want to be able to be y2k compliant therefore, want to be able to
>handle 4 digit years.

This is automatic. You may be confusing the way a date displays with the way it is stored.

>#1: How do I get it to take "10-Jan-1998" instead of "10-Jan-98" ?

Use the to_date function. For example:

	insert into my_table (date_field)
	values (to_date('10-Jan-1998','dd-mon-yyyy'));

>#2: Do I even have to worry about that at all, i.e. Oracle 7 already takes all
>years and stores as 4 digit yrs.

It's worth the trouble to specify all four digits explicitly. That way you KNOW for sure what is going on.

>#3: If so, entering "10-Jan-00" will make sense and after input, doing an order
>will show "00" as the latest year.

If you use a date field in the order-by clause of a query, the results will be sorted based on the full value of the date. To see what's going on, try selecting to_date(date_field,'dd-mon-yyyy').

drop me a note if you have more questions.

Jonathan



Jonathan Gennick
gennick_at_worldnet.att.net
http://home.att.net/~gennick Received on Tue Dec 02 1997 - 00:00:00 CET

Original text of this message