This class has been created for use with the tomahawk InputCalendar component. It exists for the following reasons:
This implementation does extend the SimpleDateFormat class by adding the JODA "xxxx" yearOfWeekYear format option, as this is missing in the standard SimpleDateFormat class.
The parse methods also return null on error rather than throw an exception.
The code here was originally written in javascript (date.js), and has been ported to java.
At the current time, the following format options are NOT supported: DFkKSzZ
.
ISO standard ISO-8601 defines a calendaring system based not upon year/month/day_in_month but instead year/week/day_in_week. This is particularly popular in embedded systems as date arithmetic is much simpler; there are no irregular month lengths to handle.
The only tricky part is mapping to and from year/month/day formats. Unfortunately, while java.text.SimpleDateFormat does support a "ww" week format character, it has a number of flaws.
Weeks are always complete and discrete, ie week yyyy-ww always has 7 days in it, and never "shares" days with yyyy-(ww+1). However to achieve this, the last week of a year might include a few days of the next year, or the last few days of a year might be counted as part of the first week of the following year. The decision is made depending on which year the "majority" of days in that week belong to.
With ISO-8601, a week always starts on a monday. However many countries use a different convention, starting weeks on saturday, sunday or monday. This class supports setting the firstDayOfWeek. @since 1.1.7 @author Simon Kitching (latest modification by $Author: grantsmith $) @version $Revision: 472638 $ $Date: 2006-11-08 15:54:13 -0500 (Wed, 08 Nov 2006) $
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|