File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes more Calendar stuff Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "more Calendar stuff" Watch "more Calendar stuff" New topic
Author

more Calendar stuff

andrew mcmillan
Greenhorn

Joined: Jun 06, 2001
Posts: 14
when outputting a date string from a Calendar in SHORT format i get the string '25.10.01'. but if i read this string back in to set the calendar date it assumes the year to be 0001 and not 2001.
how do i get the Calendar or DateForat class to assume that if year 01 is found assume its 2001 not 0001.
Manfred Leonhardt
Ranch Hand

Joined: Jan 09, 2001
Posts: 1492
Hi Andrew,
Whenever you use DateFormat you must use it on both ends. What does that mean? Well you have used it to output your string into SHORT form, so you must also use it when you read in back in from SHORT form. The following example shows what I am talking about.

Regards,
Manfred.
Jim Yingst
Wanderer
Sheriff

Joined: Jan 30, 2000
Posts: 18671
You can also use a SimpleDateFormat, which allows you to specify how two-digit years are interpreted using the method set2DigitYearStart().

"I'm not back." - Bill Harding, Twister
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: more Calendar stuff