|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.quadrique.jbuildingblocks.core.time.JbbDate
public class JbbDate
This class provides convenience routines for date and time manipulation:
| Method Summary | |
|---|---|
int |
compareTo(Date date)
convenience method to compare a JbbDate instance with a Date instance |
int |
compareTo(JbbDate date)
convenience method to compare 2 JbbDate instance |
String |
formatDate()
the formatting is based on the current locale |
String |
formatDate(String format)
|
String |
formatDateFull()
|
String |
formatDateLong()
|
String |
formatDateMedium()
|
String |
formatDateShort()
format the date as a string in short format (SHORT is completely numeric, such as 12.13.52 or 3:30pm). |
String |
formatDateTime()
format the date as a string in the default format for the current locale the formatting is based on the current locale |
String |
formatDateTime(String format)
|
String |
formatDateTimeFull()
format the date as a string in short format (FULL is pretty completely specified, such as Tuesday, April 12, 1952 AD or 3:30:42pm PST). |
String |
formatDateTimeLong()
format the date as a string in short format (LONG is longer, such as January 12, 1952 or 3:30:32pm). |
String |
formatDateTimeMedium()
format the date as a string in short format (MEDIUM is longer, such as Jan 12, 1952 ). |
String |
formatDateTimeRfc822()
The RFC 2822 date and timeis described as: // rfc1123-date = wkday "," SP date1 SP time SP "GMT" // date1 = 2DIGIT SP month SP 4DIGIT // ; day month year (e.g., 02 Jun 1982) // time = 2DIGIT ":" 2DIGIT ":" 2DIGIT // ; 00:00:00 - 23:59:59 // wkday = "Mon" | "Tue" | "Wed" // | "Thu" | "Fri" | "Sat" | "Sun" // month = "Jan" | "Feb" | "Mar" | "Apr" // | "May" | "Jun" | "Jul" | "Aug" // | "Sep" | "Oct" | "Nov" | "Dec" Sample: "Mon, 26 Feb 2007 21:23:14 +0100" |
String |
formatDateTimeShort()
format the date as a string in short format (SHORT is completely numeric, such as 12.13.52 or 3:30pm). |
String |
formatDateTimeXsd()
The xsd:dateTime format is described in chapter 4 of ISO 8601 and the W3C consortium (http://www.w3.org/TR/NOTE-datetime ) In a nutshell, the format is: YYYY-MM-DDThh:mm:ss.SSS[Z|(+|-)hh:mm] The time zone may be specified as Z (UTC) or (+|-)hh:mm. |
String |
formatDateXsd()
|
String |
formatTime()
format the date as a string in the default format for the current locale the formatting is based on the current locale |
String |
formatTimeFull()
format the date as a string in short format (FULL is pretty completely specified, such as Tuesday, April 12, 1952 AD or 3:30:42pm PST). |
String |
formatTimeLong()
format the date as a string in short format (LONG is longer, such as January 12, 1952 or 3:30:32pm). |
String |
formatTimeMedium()
format the date as a string in short format (MEDIUM is longer, such as Jan 12, 1952 ). |
String |
formatTimeShort()
format the date as a string in short format (SHORT is completely numeric, such as 12.13.52 or 3:30pm). |
JbbDate |
getBeginningOfDay()
|
JbbDate |
getBeginningOfMonth()
|
JbbDate |
getBeginningOfMonth(int month)
|
JbbDate |
getBeginningOfQuarter()
|
JbbDate |
getBeginningOfQuarter(int quarterNumber)
|
JbbDate |
getBeginningOfWeek()
|
JbbDate |
getBeginningOfWeek(int weekNumber)
|
JbbDate |
getBeginningOfYear()
|
Calendar |
getCalendar()
|
Date |
getDate()
|
int |
getDayOfMonth()
|
int |
getDayOfWeek()
|
int |
getDayOfYear()
|
JbbDateDifference |
getDifference(Date dateToCompare)
|
JbbDate |
getEndOfDay()
|
JbbDate |
getEndOfMonth()
|
JbbDate |
getEndOfMonth(int month)
|
JbbDate |
getEndOfQuarter()
|
JbbDate |
getEndOfQuarter(int quarterNumber)
|
JbbDate |
getEndOfWeek()
|
JbbDate |
getEndOfWeek(int weekNumber)
|
JbbDate |
getEndOfYear()
|
int |
getHour()
|
JbbDateIntervalsDate |
getIntervals(boolean doNotExtend)
|
JbbDateIntervalsYear |
getIntervalsForEntireYear()
|
Locale |
getLocale()
|
int |
getMilliSecond()
|
int |
getMinute()
|
int |
getMonth()
|
JbbDate |
getMonth(int month)
|
int |
getNbOfDaysBetweenDates()
|
int |
getNbOfDaysBetweenDates(Date inputDate)
|
long |
getNbOfHoursBetweenDates()
|
long |
getNbOfHoursBetweenDates(Date inputDate)
|
long |
getNbOfMiliisecondsBetweenDates()
|
long |
getNbOfMillisecondsBetweenDates(Date inputDate)
|
long |
getNbOfMinutesBetweenDates()
|
long |
getNbOfMinutesBetweenDates(Date inputDate)
|
long |
getNbOfSecondsBetweenDates()
|
long |
getNbOfSecondsBetweenDates(Date inputDate)
|
int |
getNbOfYearsBetweenDates()
|
int |
getNbOfYearsBetweenDates(Date inputDate)
|
JbbDate |
getNextBusinessDay()
|
JbbDate |
getNextDay()
|
JbbDate |
getNextMonth()
|
JbbDate |
getNextNBusinessDay(int nbOfBusinessDays)
|
JbbDate |
getNextNDay(int numberOfDaysToAdd)
|
JbbDate |
getNextNMonth(int nbMonths)
|
JbbDate |
getNextNWeek(int nbWeeks)
|
JbbDate |
getNextNYears(int nbYears)
|
JbbDate |
getNextWeek()
|
JbbDate |
getNextYear()
|
JbbDate |
getNthDayOfMonth(int dayNumber)
|
JbbDate |
getNthDayOfWeek(int dayNumber)
|
JbbDate |
getNthDayOfWeek(int weekNumber,
int dayNumber)
|
JbbDate |
getNthDayOfWeekOnOrAfter(int dayOfTheWeek,
int hour,
int minute,
int second,
int millisecond)
|
JbbDate |
getNthDayOfYear(int dayNumber)
|
JbbDate |
getPreviousBusinessDay()
|
JbbDate |
getPreviousDay()
|
JbbDate |
getPreviousMonth()
|
JbbDate |
getPreviousNBusinessDay(int nbOfBusinessDays)
|
JbbDate |
getPreviousNDay(int nbDays)
|
JbbDate |
getPreviousNMonth(int nbMonth)
|
JbbDate |
getPreviousNWeek(int nbWeeks)
|
JbbDate |
getPreviousNYear(int nbYears)
|
JbbDate |
getPreviousWeek()
|
JbbDate |
getPreviousYear()
|
int |
getQuarter()
|
JbbDate |
getSameDayWithDifferentTime(int hour,
int minute,
int second,
int millisecond)
|
int |
getSecond()
|
TimeZone |
getTimeZone()
|
int |
getWeek()
|
int |
getYear()
|
JbbDate |
getYear(int year)
|
boolean |
isBusinessDay()
|
boolean |
isDateAfterDate2AndBeforeDate3(Date d2,
Date d3)
|
boolean |
isDateAfterDate2MinusNDays(Date d2,
int nbDays)
|
boolean |
isDateAfterDate2MinusNDaysAndBeforeDate2PlusNDays(Date d2,
int nbDays)
|
boolean |
isDateAfterDate2PlusNDays(Date d2,
int nbDays)
|
boolean |
isDateBeforeDate2MinusNDays(Date d2,
int nbDays)
|
boolean |
isDateBeforeDate2PlusNDays(Date d2,
int nbDays)
|
boolean |
isSameDay(Date inputDate)
|
static JbbDate |
newInstance()
factory method |
static JbbDate |
newInstance(Date date)
Factory method |
static JbbDate |
newInstance(Date date,
Locale locale)
Factory method |
static JbbDate |
newInstance(Date date,
Locale locale,
TimeZone timeZone)
Factory method |
static JbbDate |
newInstance(int year,
int month,
int day)
|
static JbbDate |
newInstance(int year,
int month,
int day,
int hour,
int minute,
int second,
int millisecond)
|
static JbbDate |
newInstance(int year,
int month,
int day,
int hour,
int minute,
int second,
int millisecond,
Locale locale)
|
static JbbDate |
newInstance(int year,
int month,
int day,
int hour,
int minute,
int second,
int milliseconds,
Locale locale,
TimeZone timeZone)
|
static JbbDate |
newInstance(int year,
int month,
int day,
Locale locale)
|
static JbbDate |
newInstance(int year,
int month,
int day,
Locale locale,
TimeZone timeZone)
|
static JbbDate |
newInstance(Locale locale)
factory method |
static JbbDate |
newInstance(Locale locale,
TimeZone timeZone)
factory method |
static JbbDate |
newInstance(long date)
Factory method |
static JbbDate |
newInstance(long date,
Locale locale)
Factory method |
static JbbDate |
newInstance(long date,
Locale locale,
TimeZone timeZone)
Factory method |
static JbbDate |
newInstanceFromRfc822String(String xsdDateTime)
|
static JbbDate |
newInstanceFromRfc822String(String xsdDateTime,
Locale locale)
|
static JbbDate |
newInstanceFromRfc822String(String xsdDateTime,
Locale locale,
TimeZone timeZone)
|
static JbbDate |
newInstanceFromXsdString(String xsdDateTime)
|
static JbbDate |
newInstanceFromXsdString(String xsdDateTime,
Locale locale)
|
static JbbDate |
newInstanceFromXsdString(String xsdDateTime,
Locale locale,
TimeZone timeZone)
|
void |
setBeginningOfDay()
calls the getBeginningOfDay() and changes the internal state to the return value. |
void |
setBeginningOfMonth()
calls the getBeginningOfMonth() and changes the internal state to the return value. |
void |
setBeginningOfMonth(int month)
calls the getBeginningOfMonth(int month) and changes the internal state to the return value. |
void |
setBeginningOfQuarter()
calls the getBeginningOfQuarter() and changes the internal state to the return value. |
void |
setBeginningOfQuarter(int quarterNumber)
calls the getBeginningOfQuarter(int quarterNumber) and changes the internal state to the return value. |
void |
setBeginningOfWeek()
calls the getBeginningOfWeek() and changes the internal state to the return value. |
void |
setBeginningOfWeek(int weekNumber)
calls the getBeginningOfWeek(weekNumber) and changes the internal state to the return value. |
void |
setBeginningOfYear()
calls the getBeginningOfYear() and changes the internal state to the return value. |
void |
setEndOfDay()
calls the getEndOfDay() and changes the internal state to the return value. |
void |
setEndOfMonth()
calls the getEndOfMonth() and changes the internal state to the return value. |
void |
setEndOfMonth(int month)
calls the getEndOfMonth(int month) and changes the internal state to the return value. |
void |
setEndOfQuarter()
calls the getEndOfQuarter() and changes the internal state to the return value. |
void |
setEndOfQuarter(int quarterNumber)
calls the getEndOfQuarter(int quarterNumber) and changes the internal state to the return value. |
void |
setEndOfWeek()
calls the getEndOfWeek() and changes the internal state to the return value. |
void |
setEndOfWeek(int weekNumber)
calls the getEndOfWeek(weekNumber) and changes the internal state to the return value. |
void |
setEndOfYear()
calls the getEndOfYear() and changes the internal state to the return value. |
void |
setMonth(int month)
calls the getMonth(month) and changes the internal state to the return value. |
void |
setNextBusinessDay()
calls the getNextBusinessDay() and changes the internal state to the return value. |
void |
setNextDay()
calls the getNextDay() and changes the internal state to the return value. |
void |
setNextMonth()
calls the getNextMonth() and changes the internal state to the return value. |
void |
setNextNBusinessDay(int nbOfBusinessDays)
calls the getNextNBusinessDay(nbOfBusinessDays) and changes the internal state to the return value. |
void |
setNextNDay(int numberOfDaysToAdd)
calls the getNextNDay(numberOfDaysToAdd) and changes the internal state to the return value. |
void |
setNextNMonth(int nbMonths)
calls the getNextNMonth(int nbMonths) and changes the internal state to the return value. |
void |
setNextNWeek(int nbWeeks)
calls the getNextNWeek(nbWeeks) and changes the internal state to the return value. |
void |
setNextNYears(int nbYears)
calls the getNextNYears(nbYears) and changes the internal state to the return value. |
void |
setNextWeek()
calls the getNextWeek() and changes the internal state to the return value. |
void |
setNextYear()
calls the getNextYear() and changes the internal state to the return value. |
void |
setNthDayOfMonth(int dayNumber)
calls the getNthDayOfMonth(int dayNumber) and changes the internal state to the return value. |
void |
setNthDayOfWeek(int dayNumber)
calls the getNthDayOfWeek(int dayNumber) and changes the internal state to the return value. |
void |
setNthDayOfWeek(int weekNumber,
int dayNumber)
calls the getNthDayOfWeek(int weekNumber, int dayNumber) and changes the internal state to the return value. |
void |
setNthDayOfWeekOnOrAfter(int dayOfTheWeek,
int hour,
int minute,
int second,
int millisecond)
calls the getNthDayOfWeekOnOrAfter(int dayOfTheWeek, int hour, int minute, int second, int millisecond) and changes the internal state to the return value. |
void |
setNthDayOfYear(int dayNumber)
calls the getNthDayOfYear(int dayNumber) and changes the internal state to the return value. |
void |
setPreviousBusinessDay()
calls the getPreviousBusinessDay() and changes the internal state to the return value. |
void |
setPreviousDay()
calls the getPreviousDay() and changes the internal state to the return value. |
void |
setPreviousMonth()
calls the getPreviousMonth() and changes the internal state to the return value. |
void |
setPreviousNBusinessDay(int nbOfBusinessDays)
calls the getPreviousNBusinessDay(nbOfBusinessDays) and changes the internal state to the return value. |
void |
setPreviousNDay(int nbDays)
calls the getPreviousNDay() and changes the internal state to the return value. |
void |
setPreviousNMonth(int nbMonth)
calls the getPreviousNMonth(int nbMonth) and changes the internal state to the return value. |
void |
setPreviousNWeek(int nbWeeks)
calls the getPreviousNWeek(nbWeeks) and changes the internal state to the return value. |
void |
setPreviousNYear(int nbYears)
calls the getPreviousNYear(int nbYears) and changes the internal state to the return value. |
void |
setPreviousWeek()
calls the getPreviousWeek() and changes the internal state to the return value. |
void |
setPreviousYear()
calls the getPreviousYear() and changes the internal state to the return value. |
void |
setSameDayWithDifferentTime(int hour,
int minute,
int second,
int millisecond)
calls the getSameDayWithDifferentTime(int hour, int minute, int second, int millisecond) and changes the internal state to the return value. |
void |
setYear(int year)
calls the getYear(year) and changes the internal state to the return value. |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static JbbDate newInstance()
public static JbbDate newInstance(Locale locale)
locale - the locale to use
public static JbbDate newInstance(Locale locale,
TimeZone timeZone)
timeZone - the timeZone to use
public static JbbDate newInstance(Date date,
Locale locale)
date - the reference date to uselocale -
public static JbbDate newInstance(Date date,
Locale locale,
TimeZone timeZone)
date - the reference date to uselocale -
public static JbbDate newInstance(Date date)
date -
public static JbbDate newInstance(long date)
date -
public static JbbDate newInstance(long date,
Locale locale)
date - The date expressed as a number of milliseconds since January 1,1970locale -
public static JbbDate newInstance(long date,
Locale locale,
TimeZone timeZone)
date - The date expressed as a number of milliseconds since January 1,1970locale -
public static JbbDate newInstance(int year,
int month,
int day,
int hour,
int minute,
int second,
int milliseconds,
Locale locale,
TimeZone timeZone)
throws Exception
year - e.g. 2008month - 0 - 11day - 1 - ...hour - 0 - 23minute - 0 - 59second - 0 - 59milliseconds - 0- 999locale -
Exception
public static JbbDate newInstance(int year,
int month,
int day,
Locale locale)
throws Exception
year - e.g. 2008month - 0 - 11day - 1 - ...locale -
Exception
public static JbbDate newInstance(int year,
int month,
int day,
Locale locale,
TimeZone timeZone)
throws Exception
year - e.g. 2008month - 0 - 11day - 1 - ...locale -
Exception
public static JbbDate newInstance(int year,
int month,
int day,
int hour,
int minute,
int second,
int millisecond)
throws Exception
year - e.g. 2008month - 0 - 11day - 1 - ...hour - 0 - 23minute - 0 - 59second - 0 - 59milliseconds - 0- 999
Exception
public static JbbDate newInstance(int year,
int month,
int day,
int hour,
int minute,
int second,
int millisecond,
Locale locale)
throws Exception
year - e.g. 2008month - 0 - 11day - 1 - ...hour - 0 - 23minute - 0 - 59second - 0 - 59milliseconds - 0- 999
Exception
public static JbbDate newInstance(int year,
int month,
int day)
throws Exception
year - e.g. 2008month - 0 - 11day - 1 - ...
Exception
public static JbbDate newInstanceFromXsdString(String xsdDateTime,
Locale locale,
TimeZone timeZone)
throws Exception
xsdDateTime -
Exception
public static JbbDate newInstanceFromXsdString(String xsdDateTime,
Locale locale)
throws Exception
xsdDateTime -
Exception
public static JbbDate newInstanceFromXsdString(String xsdDateTime)
throws Exception
xsdDateTime -
Exception
public static JbbDate newInstanceFromRfc822String(String xsdDateTime,
Locale locale,
TimeZone timeZone)
throws Exception
xsdDateTime -
Exception
public static JbbDate newInstanceFromRfc822String(String xsdDateTime,
Locale locale)
throws Exception
xsdDateTime -
Exception
public static JbbDate newInstanceFromRfc822String(String xsdDateTime)
throws Exception
xsdDateTime -
Exceptionpublic Calendar getCalendar()
public Date getDate()
public String formatDate()
public String formatDateMedium()
public String formatDateLong()
public String formatDateFull()
public String formatDateShort()
public String formatDateTime()
public String formatDateTimeShort()
public String formatDateTimeMedium()
public String formatDateTimeLong()
public String formatDateTimeFull()
public String formatTime()
public String formatTimeShort()
public String formatTimeMedium()
public String formatTimeLong()
public String formatTimeFull()
public JbbDate getPreviousDay()
public void setPreviousDay()
public JbbDate getPreviousNDay(int nbDays)
nbDays - the number of days
public void setPreviousNDay(int nbDays)
public boolean isBusinessDay()
public JbbDate getPreviousBusinessDay()
public void setPreviousBusinessDay()
public JbbDate getPreviousNBusinessDay(int nbOfBusinessDays)
nbOfBusinessDays - the number of business days
public void setPreviousNBusinessDay(int nbOfBusinessDays)
public JbbDate getNextBusinessDay()
public void setNextBusinessDay()
public JbbDate getNextNBusinessDay(int nbOfBusinessDays)
nbOfBusinessDays - the number of business days
public void setNextNBusinessDay(int nbOfBusinessDays)
public JbbDate getEndOfDay()
public void setEndOfDay()
public JbbDate getBeginningOfDay()
public void setBeginningOfDay()
public JbbDate getBeginningOfWeek()
public void setBeginningOfWeek()
public JbbDate getEndOfWeek()
public void setEndOfWeek()
public JbbDate getPreviousWeek()
public void setPreviousWeek()
public JbbDate getPreviousNWeek(int nbWeeks)
nbWeeks - 1 for the previous week...
public void setPreviousNWeek(int nbWeeks)
public JbbDate getPreviousMonth()
public void setPreviousMonth()
public JbbDate getPreviousNMonth(int nbMonth)
nbMonth -
public void setPreviousNMonth(int nbMonth)
public JbbDate getBeginningOfMonth()
public void setBeginningOfMonth()
public JbbDate getBeginningOfMonth(int month)
public void setBeginningOfMonth(int month)
public JbbDate getEndOfMonth()
public void setEndOfMonth()
public JbbDate getEndOfMonth(int month)
public void setEndOfMonth(int month)
public JbbDate getNextDay()
public void setNextDay()
public JbbDate getNextNDay(int numberOfDaysToAdd)
numberOfDaysToAdd -
public void setNextNDay(int numberOfDaysToAdd)
public JbbDate getNextWeek()
public void setNextWeek()
public JbbDate getNextNWeek(int nbWeeks)
public void setNextNWeek(int nbWeeks)
public JbbDate getNextMonth()
public void setNextMonth()
public JbbDate getNextNMonth(int nbMonths)
public void setNextNMonth(int nbMonths)
public void setNthDayOfWeekOnOrAfter(int dayOfTheWeek,
int hour,
int minute,
int second,
int millisecond)
public JbbDate getSameDayWithDifferentTime(int hour,
int minute,
int second,
int millisecond)
hour - 0 to 23minute - 0 to 59second - 0 to 59millisecond - 0 to 999
Date tomorrow = DateHandler.getNextDay();
Date tomorrowAt3PM = DateHandler.getSameDay(tomorrow,3,0,0,0);
public void setSameDayWithDifferentTime(int hour,
int minute,
int second,
int millisecond)
public boolean isSameDay(Date inputDate)
inputDate - the second date
public boolean isDateAfterDate2PlusNDays(Date d2,
int nbDays)
d1 - d2 - nbDays -
public boolean isDateAfterDate2MinusNDays(Date d2,
int nbDays)
d2 - nbDays -
public boolean isDateBeforeDate2PlusNDays(Date d2,
int nbDays)
d2 - nbDays -
public boolean isDateBeforeDate2MinusNDays(Date d2,
int nbDays)
d2 - nbDays -
public boolean isDateAfterDate2MinusNDaysAndBeforeDate2PlusNDays(Date d2,
int nbDays)
d2 - nbDays -
public boolean isDateAfterDate2AndBeforeDate3(Date d2,
Date d3)
d2 - d3 -
public int getNbOfYearsBetweenDates()
throws JbbInvalidArgumentException
birthDate -
JbbInvalidArgumentException - when the birthDate is after the current system date
public int getNbOfYearsBetweenDates(Date inputDate)
throws JbbInvalidArgumentException
inputDate -
JbbInvalidArgumentException - when the birth date is after the reference date or when birthDate is nullpublic JbbDate getBeginningOfYear()
public void setBeginningOfYear()
public JbbDate getEndOfYear()
public void setEndOfYear()
public long getNbOfMiliisecondsBetweenDates()
inputDate -
Exceptionpublic long getNbOfMillisecondsBetweenDates(Date inputDate)
inputDate -
Exceptionpublic long getNbOfSecondsBetweenDates()
inputDate -
Exceptionpublic long getNbOfSecondsBetweenDates(Date inputDate)
inputDate -
Exceptionpublic long getNbOfMinutesBetweenDates()
inputDate -
Exceptionpublic long getNbOfMinutesBetweenDates(Date inputDate)
inputDate -
Exceptionpublic long getNbOfHoursBetweenDates()
inputDate -
Exceptionpublic long getNbOfHoursBetweenDates(Date inputDate)
inputDate -
Exceptionpublic int getNbOfDaysBetweenDates()
inputDate -
Exceptionpublic int getNbOfDaysBetweenDates(Date inputDate)
inputDate -
Exceptionpublic int getYear()
public int getMonth()
public int getDayOfYear()
public int getDayOfMonth()
public int getDayOfWeek()
public int getHour()
public int getMinute()
public int getSecond()
public int getMilliSecond()
public JbbDateDifference getDifference(Date dateToCompare)
dateToCompare -
public int getQuarter()
public JbbDateIntervalsYear getIntervalsForEntireYear()
throws Exception
Exception
public JbbDateIntervalsDate getIntervals(boolean doNotExtend)
throws Exception
doNotExtend - if true, the end date of each date interval is set to the end of the week that contains the reference day. For instance, the week interval is set to (assuming USA locale):
Exception
public JbbDate getBeginningOfQuarter()
throws Exception
Exception
public void setBeginningOfQuarter()
throws Exception
Exception
public JbbDate getEndOfQuarter()
throws Exception
Exception
public void setEndOfQuarter()
throws Exception
Exception
public JbbDate getBeginningOfQuarter(int quarterNumber)
throws Exception
quarterNumber - 1 for Q1, ... 4 for Q4
Exception
public void setBeginningOfQuarter(int quarterNumber)
throws Exception
Exception
public JbbDate getEndOfQuarter(int quarterNumber)
throws Exception
quarterNumber - 1 for Q1, ... 4 for Q4
Exception
public void setEndOfQuarter(int quarterNumber)
throws Exception
Exception
public JbbDate getNthDayOfMonth(int dayNumber)
throws Exception
dayNumber - 1 to 31
Exception
public void setNthDayOfMonth(int dayNumber)
throws Exception
Exception
public JbbDate getNthDayOfYear(int dayNumber)
throws Exception
dayNumber - 1 to 365
Exception
public void setNthDayOfYear(int dayNumber)
throws Exception
Exceptionpublic JbbDate getPreviousYear()
public void setPreviousYear()
throws Exception
Exceptionpublic JbbDate getPreviousNYear(int nbYears)
nbYears -
public void setPreviousNYear(int nbYears)
throws Exception
Exceptionpublic JbbDate getNextYear()
public void setNextYear()
throws Exception
Exceptionpublic JbbDate getNextNYears(int nbYears)
nbYears -
public void setNextNYears(int nbYears)
throws Exception
Exceptionpublic String formatDateXsd()
public String formatDate(String format)
throws Exception
format - the format string. It is a String which may contain fixed text and one or more embedded format specifiers. Consider the following example:
String s = String.format("Today is: %1$tY-%1$tm-%1$td",new Date());
-> When called on the 23rd of April 2007, the returned String would be "Today is 2007-04-23"
The format specifiers for types which are used to represents dates and times have the following syntax:
%1$tconversion
The following conversion characters are used for formatting dates: 'B' Locale-specific full month name, e.g. "January", "February". //'b' Locale-specific abbreviated month name, e.g. "Jan", "Feb". //'h' Same as 'b'. //'A' Locale-specific full name of the day of the week, e.g. "Sunday", "Monday" //'a' Locale-specific short name of the day of the week, e.g. "Sun", "Mon" //'C' Four-digit year divided by 100, formatted as two digits with leading zero as necessary, i.e. 00 - 99 //'Y' Year, formatted as at least four digits with leading zeros as necessary, e.g. 0092 equals 92 CE for the Gregorian calendar. //'y' Last two digits of the year, formatted with leading zeros as necessary, i.e. 00 - 99. //'j' Day of year, formatted as three digits with leading zeros as necessary, e.g. 001 - 366 for the Gregorian calendar. //'m' Month, formatted as two digits with leading zeros as necessary, i.e. 01 - 13. //'d' Day of month, formatted as two digits with leading zeros as necessary, i.e. 01 - 31 //'e' Day of month, formatted as two digits, i.e. 1 - 31.
//The following conversion characters are used for formatting common date/time compositions. //'D' Date formatted as "%tm/%td/%ty". //'F' ISO 8601 complete date formatted as "%tY-%tm-%td".
Exception
public String formatDateTime(String format)
throws Exception
format - the format string. It is a String which may contain fixed text and one or more embedded format specifiers. Consider the following example:
String s = String.format("Today is: %1$tY-%1$tm-%1$td",new Date());
-> When called on the 23rd of April 2007, the returned String would be "Today is 2007-04-23"
The format specifiers for types which are used to represents dates and times have the following syntax:
%1$conversion
The following conversion characters are used for formatting times: 'H' Hour of the day for the 24-hour clock, formatted as two digits with a leading zero as necessary i.e. 00 - 23. 'I' Hour for the 12-hour clock, formatted as two digits with a leading zero as necessary, i.e. 01 - 12. 'k' Hour of the day for the 24-hour clock, i.e. 0 - 23. 'l' Hour for the 12-hour clock, i.e. 1 - 12. 'M' Minute within the hour formatted as two digits with a leading zero as necessary, i.e. 00 - 59. 'S' Seconds within the minute, formatted as two digits with a leading zero as necessary, i.e. 00 - 60 ("60" is a special value required to support leap seconds). 'L' Millisecond within the second formatted as three digits with leading zeros as necessary, i.e. 000 - 999. 'N' Nanosecond within the second, formatted as nine digits with leading zeros as necessary, i.e. 000000000 - 999999999. 'p' Locale-specific morning or afternoon marker in lower case, e.g."am" or "pm". Use of the conversion prefix 'T' forces this output to upper case. 'z' RFC 822 style numeric time zone offset from GMT, e.g. -0800. 'Z' A string representing the abbreviation for the time zone. The Formatter's locale will supersede the locale of the argument (if any). 's' Seconds since the beginning of the epoch starting at 1 January 1970 00:00:00 UTC, i.e. Long.MIN_VALUE/1000 to Long.MAX_VALUE/1000. 'Q' Milliseconds since the beginning of the epoch starting at 1 January 1970 00:00:00 UTC, i.e. Long.MIN_VALUE to Long.MAX_VALUE.
The following conversion characters are used for formatting dates: 'B' Locale-specific full month name, e.g. "January", "February". //'b' Locale-specific abbreviated month name, e.g. "Jan", "Feb". //'h' Same as 'b'. //'A' Locale-specific full name of the day of the week, e.g. "Sunday", "Monday" //'a' Locale-specific short name of the day of the week, e.g. "Sun", "Mon" //'C' Four-digit year divided by 100, formatted as two digits with leading zero as necessary, i.e. 00 - 99 //'Y' Year, formatted as at least four digits with leading zeros as necessary, e.g. 0092 equals 92 CE for the Gregorian calendar. //'y' Last two digits of the year, formatted with leading zeros as necessary, i.e. 00 - 99. //'j' Day of year, formatted as three digits with leading zeros as necessary, e.g. 001 - 366 for the Gregorian calendar. //'m' Month, formatted as two digits with leading zeros as necessary, i.e. 01 - 13. //'d' Day of month, formatted as two digits with leading zeros as necessary, i.e. 01 - 31 //'e' Day of month, formatted as two digits, i.e. 1 - 31.
//The following conversion characters are used for formatting common date/time compositions. //'R' Time formatted for the 24-hour clock as "%tH:%tM" //'T' Time formatted for the 24-hour clock as "%tH:%tM:%tS". //'r' Time formatted for the 12-hour clock as "%tI:%tM:%tS %Tp". The location of the morning or afternoon marker ('%Tp') may be locale-dependent. //'D' Date formatted as "%tm/%td/%ty". //'F' ISO 8601 complete date formatted as "%tY-%tm-%td". //'c' Date and time formatted as "%ta %tb %td %tT %tZ %tY", e.g. "Sun Jul 20 16:17:00 EDT 1969".
Exceptionpublic void setYear(int year)
public JbbDate getYear(int year)
year - to set
public void setMonth(int month)
throws Exception
Exception
public JbbDate getMonth(int month)
throws Exception
year - to set
Exceptionpublic int compareTo(Date date)
Comparable.compareTo(java.lang.Object)public int compareTo(JbbDate date)
compareTo in interface Comparable<JbbDate>Comparable.compareTo(java.lang.Object)public TimeZone getTimeZone()
public Locale getLocale()
public String formatDateTimeXsd()
public String formatDateTimeRfc822()
public int getWeek()
public JbbDate getNthDayOfWeek(int weekNumber,
int dayNumber)
weekNumber - 1 - 53dayNumber - 1 - 7
public JbbDate getBeginningOfWeek(int weekNumber)
weekNumber - 1 to 52
public void setBeginningOfWeek(int weekNumber)
public JbbDate getEndOfWeek(int weekNumber)
weekNumber - year -
public void setEndOfWeek(int weekNumber)
throws Exception
Exception
public JbbDate getNthDayOfWeek(int dayNumber)
throws Exception
dayNumber -
Exception
public void setNthDayOfWeek(int dayNumber)
throws Exception
Exception
public void setNthDayOfWeek(int weekNumber,
int dayNumber)
throws Exception
Exception
public JbbDate getNthDayOfWeekOnOrAfter(int dayOfTheWeek,
int hour,
int minute,
int second,
int millisecond)
dayOfTheWeek - the desired day of week (e.g. Calendar.TUESDAY)hour - the desired hour (0 to 23)minute - the desired minute (0 to 59)second - the desired second (0 to 59)millisecond - the desired millisecond (0 to 999)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||