Re: Can you have one that is just mm/dd or mm/yyyy etc?
- From: "Rhino" <no.offline.contact.please@xxxxxxxxxx>
- Date: Tue, 25 Apr 2006 19:57:24 -0400
"LibbyChantel" <LibbyChantel@xxxxxxxxx> wrote in message
news:1146002568.852994.81030@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
I need to store some data in this format: "mm/yyyy" as a Date orWhy is storing the date as a String not an option?
DateTime. I can create SimpleDateFormat("mm/yyyy"), but when I do
format.parse() on "12/2001" it helpfully returns "December 1, 2001". I
need to store it as a DateTime of December 2001. Storing it as a String
is not an option.
I think you'll need to go that route. Or you could put the month name in a
String and the year in an int and then bundle them together in a new Class
with a name like MonthYear; that class could have methods to get the year
and the month individually for convenience and to format the value however
you want it.
Another way to go would be store an arbitrary day with your month and year
and then just ignore the day portion but I don't much like that; it feels
like bad design to me although I can't articulate exactly what is wrong with
it.
Has anyone dealt with this kind of situation before and could point meThis is a pretty unusual requirement, at least in my experience. In my view,
in the right direction to understand how to handle this?
a date always includes a year, month and a day of the month; I wouldn't even
call the combination of year and month alone a date, really.
In business, you normally store a year, month and a day for every 'event',
like a bill payment or an insurance claim. Your reports may end up
summarizing by year and month but then the month/year combination would
normally be stored as a String, if it was stored at all. At least that's
been my experience.
Sorry I couldn't tell you what you wanted to her. Maybe someone else will
have a different take on this question.
--
Rhino
.
- References:
- 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: Re: java applet classpath
- Next by Date: 345 free programming books
- Previous by thread: 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
|