<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.

What rule do you want to use for century?  VB's, Oracle's, your
(application's) own?

The simplest approach is probably to use Oracle (assuming no time fractions
saved, and only those two formats in existence):

SELECT TO_CHAR(DECODE(Len(RTrim(colMyDateStr)), 
                8, TO_Date(colMyDateStr, "MM/DD/YY"), 
                10, TO_Date(colMyDateStr, "MM/DD/YYYY"), 
                NULL), "MM/DD/YYYY") as RealDate, ...

That will return all (valid 8 or 10 character long) date strings with
4-digit year.  In your app, use an explicit conversion to a date variable
for ANY type of manipulation.

You should prove that there are no other formats in the database, for
instance by:

SELECT Count(*)
FROM MyTable
WHERE RTRIM(colMyDateStr) Not Like '__/__/__'
AND RTRIM(colMyDateStr) Not Like '__/__/____'

</pet peeve>

HTH,
Tore.

-----Original Message-----
From: Michael Gerholdt [mailto:[EMAIL PROTECTED]]
Sent: Thursday, August 29, 2002 2:07 PM
To: ActiveServerPages
Subject: date problem


I have an app that pulls dates from an Oracle database where they are stored
like

04/21/1952

the SQL string is "select * from ..." as I'm using all columns. Some of
these columns are dates but they are always shortened to the MM/DD/YY form

04/21/52

and then when I've allowed the user to edit and update it is always saved as

04/21/2052

The date format on my local PC is MM/DD/YYYY for short date - it's my
understanding that VB will use the system formats.

OS is XP.

Any ideas?

Thanks,
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 PROTECTED]

Reply via email to