Re: Date: Can you have one that is just mm/dd or mm/yyyy etc?
- From: "Bjorn Abelli" <bjorn_abelli@xxxxxxxxxxxxxxxxxxxxx>
- Date: 26 Apr 2006 17:18:08 +0200
"LibbyChantel" wrote...
"Thomas Weidenfeller" wrote...
"LibbyChantel" wrote...
Unfortunately, yes, I do.
No, you don't. You are mixing up the representation of a value,
and the value itself.
OK, you're right I don't.
I studied the API doc for SimpleDateFormat before
submitting my plea for help. I guess my real question
is, how do I know if a Date portion such as day is not
a valid value for my application, ie when Date = 01/05/2001,
how do I know to ignore the month portion (or day, or year)
because it is only a placeholder? If I try to create a Date
with 01/00/2001 or some such, I of course get an
unparseableDate exception.
I think you still need to think over what Thomas said; to realize that
there's a difference between a value and its representation.
A Date is internally represented by a long (number of milliseconds since
since January 1, 1970, 00:00:00 GMT), but as such it can only have values
that corresponds to valid times and dates. There's no way around that.
You actually provided half the answer to the solution yourself in a previous
post.
You want to format an SQL statement (which is represented by a *String*):
"LIKE %theMm/yyyyDate%"
....which means that what you put into that string should be a string itself.
In order to provide the *format* of that part of the string, you simply use
a SimpleDateFormat to format a valid Date into the String representation you
like, even excluding the day part.
That is what you want to put into your SQL statement, not the Date itself.
// Bjorn A
Inviato da X-Privat.Org - Registrazione gratuita http://www.x-privat.org/join.php
.
- Follow-Ups:
- Re: Date: Can you have one that is just mm/dd or mm/yyyy etc?
- From: LibbyChantel
- Re: Date: Can you have one that is just mm/dd or mm/yyyy etc?
- References:
- Date: Can you have one that is just mm/dd or mm/yyyy etc?
- From: LibbyChantel
- Re: Date: Can you have one that is just mm/dd or mm/yyyy etc?
- From: Thomas Weidenfeller
- Re: Date: Can you have one that is just mm/dd or mm/yyyy etc?
- From: LibbyChantel
- Re: Date: Can you have one that is just mm/dd or mm/yyyy etc?
- From: Thomas Weidenfeller
- Re: Date: Can you have one that is just mm/dd or mm/yyyy etc?
- From: LibbyChantel
- Date: Can you have one that is just mm/dd or mm/yyyy etc?
- Prev by Date: Java IDEs *Le sigh*
- Next by Date: Re: Thread loop cycle time
- Previous by thread: Re: Date: Can you have one that is just mm/dd or mm/yyyy etc?
- Next by thread: Re: Date: Can you have one that is just mm/dd or mm/yyyy etc?
- Index(es):
Relevant Pages
|