Re: Date: Can you have one that is just mm/dd or mm/yyyy etc?
"LibbyChantel" <LibbyChantel@yahoo.com> wrote in message
news:1146065213.847047.119090@g10g2000cwb.googlegroups.com...
You guys are totally missing the point.
I'm not totally following either.
My question is not how to
format a date to use it in SQL, which is why I left that information
out originally. My question was, is there a way to save only a portion
of a date in a Date object?
No, there isn't.
My solution is to extend the Date Object and add a field to it which
denotes whether the entire date is valid, or just some combination of
mm/yyyy, etc But I thought maybe there was a way to use the original
Date object without "enhancing" it. I am REQUIRED to store the date in
a Date, even if it is invalid : )
Careful the way you phrase this. You say you're "required to store the
date in a Date", but might your requirements be "store the date", without
regards of the actual class where the Date is stored?
If you really do need to use the Date object, you're out of luck. The
date object simply doesn't support what you want. Even if you extend the
Date object to add functionalities, when you pass that Date object to an SQL
database, the database isn't going to know about your extended
functionalities, and will simply store Dates the way it always has.
You should probably go a level higher in abstraction, and describe what
you're trying to do, rather than describe how you want to do it.
- Oliver