David,

TO_DATE() converts a (date) string to an Oracle Date datatype.  This is good
for INSERT, UPDATE and for use in the WHERE clause, etc.  However, to select
an Oracle Date datatype value and convert it to a date string in a
particular format, you would use TO_CHAR(<DateColumn>, '<dateformat>')

Regards,
Tore.

-----Original Message-----
From: David L. Penton [mailto:[EMAIL PROTECTED]]
Sent: Friday, August 30, 2002 10:25 AM
To: ActiveServerPages
Subject: RE: date problem


The Oracle date format you select out can be changed.  The date formatting
function for Oracle is TO_DATE()


TO_DATE('dateString', 'dateFormatHere')

where dateFormatHere is the exact format the dateString is in.

David L. Penton, Microsoft MVP
JCPenney Technical Specialist / Lead
"Mathematics is music for the mind, and Music is Mathematics for the
Soul. - J.S. Bach"
[EMAIL PROTECTED]

Do you have the VBScript Docs or SQL BOL installed?  If not, why not?
VBScript Docs: http://www.davidpenton.com/vbscript
SQL BOL: http://www.davidpenton.com/sqlbol

-----Original Message-----
From: TomMallard [mailto:[EMAIL PROTECTED]]
Sent: Friday, August 30, 2002 8:09 AM
To: ActiveServerPages
Subject: RE: date problem


Have you tried CONVERT? Do you have the latest drivers for Oracle?

tom mallard
seattle

-----Original Message-----
From: Michael Gerholdt [mailto:[EMAIL PROTECTED]]
Sent: Friday, August 30, 2002 5:44 AM
To: ActiveServerPages
Subject: Re: date problem





> <pet peeve>
> :->  Michael - you've been a bad boy - DON'T store dates as strings! :->
>
> I assume from your description that the database column is defined as a
> char(..) or varchar2(..) in the database.  Take a serious look at
modifying
> the table structure to use a Date column instead.  The below will help in
> creating the converted column.

Actually, they are date columns both in the original source tables as well
as in the target table.

However, in the original tables (over which I have no control) even though
it is a date column in an Oracle db, it is stored like this:

04/21/1952 and not in the customary Oracle 04-APR-1952.

When I do a select in my web app, I always see only 4/21/52, and when I save
that to the target table the result is 4/21/2052.

The original tables are a load that comes from another database originally.
I'm not sure why the sql-loader script didn't provide a conversion to
Oracle's native date format, or how it preserved this format. Maybe I can
get a peek but that's not 'mine' either.

I'd prefer to use Oracle's format meself.

Mike


---
You are currently subscribed to activeserverpages as:
[EMAIL PROTECTED]
To unsubscribe send a blank email to
%%email.unsub%%


---
You are currently subscribed to activeserverpages as: [EMAIL PROTECTED]
To unsubscribe send a blank email to
%%email.unsub%%


---
You are currently subscribed to activeserverpages as: [EMAIL PROTECTED]
To unsubscribe send a blank email to
%%email.unsub%%

---
You are currently subscribed to activeserverpages as: [email protected]
To unsubscribe send a blank email to [EMAIL PROTECTED]

Reply via email to