All Packages Class Hierarchy This Package Previous Next Index
Class com.bulletproof.util.Date
java.lang.Object
|
+----com.bulletproof.util.Date
- public class Date
- extends Object
The class Date represents a specific instant
in time, with millisecond precision.
-
date
-
-
hour
-
-
millis
-
-
minute
-
-
month
-
-
second
-
-
year
-
-
Date()
- Allocates a
Date object
and intializes it to 1990/01/01.
-
Date(int)
- Allocates a
Date object
specified by the juldate argument.
-
Date(int, int, int)
- Allocates a
Date object
specified by the year, month, and
date arguments.
-
cloneDate()
- Allocates a new
Date object and initializes it so that
it represents this date object.
-
decrement(int)
- Decrement the date by one day
-
equals(Date)
- Compares two dates.
-
format(Date)
- Format a given date to the default format
-
format(Date, String)
- Format a given date to a given format
-
format(String)
- Format a given date to the default format
-
format(String, String)
- Format a given date to the default format
-
formatForSql(Date, int)
- Format a given date string create the SQL to update it to the database
-
formatForSql(Date, int, boolean)
- Format a given date string create the SQL to update it to the database
-
formatForSql(String, int)
- Format a given date string create the SQL to update it to the database
-
formatForSql(String, int, boolean)
- Format a given date string create the SQL to update it to the database
-
formatFromSystem(String)
- Format a given date to the default format
-
getDate()
- Returns the day of the month represented by this date.
-
getDay()
- Returns the day of the week represented by this date.
-
getDayOfYear()
- Get the Julian day of this date
-
getDaysInMonth()
- Get the number of days in this month
-
getDefaultFormat()
- Get the value of the date box
-
getJulianDate()
- Returns the date in a psuedo Julian format.
-
getMonth()
- Returns the month represented by this date.
-
getYear()
- Returns the year represented by this date, minus 1900.
-
increment(int)
- Increment the date by the selected number of days
-
isLeapYear(int)
- Determines if the given year is a leap year.
-
setDate(int)
- Sets the day of the month of this date to the specified value.
-
setDefaultFormat(String)
- Set the default date format
-
setJulianDate(int)
- Sets the date using a Julian format.
-
setMonth(int)
- Sets the month of this date to the specified value.
-
setYear(int)
- Sets the year of this date to be the specified value plus 1900.
-
toString()
-
-
unformat(String)
- Format a given date string create a date using the default format
-
unformat(String, String)
- Format a given date string create a date given the format
-
unformatFromSystem(String)
- Format a given date to the default format
-
unformattedDateValid()
- Check whether the last date unformatted was invalid.
year
public int year
month
public int month
date
public int date
hour
public int hour
minute
public int minute
second
public int second
millis
public int millis
Date
public Date()
- Allocates a
Date object
and intializes it to 1990/01/01.
Date
public Date(int year,
int month,
int date)
- Allocates a
Date object
specified by the year, month, and
date arguments.
- Parameters:
- year - the year minus 1900.
- month - the month between 0-11.
- date - the day of the month between 1-31.
Date
public Date(int juldate)
- Allocates a
Date object
specified by the juldate argument.
- Parameters:
- juldate - an integer in the format yyyymmdd.
cloneDate
public Date cloneDate()
- Allocates a new
Date object and initializes it so that
it represents this date object.
getDaysInMonth
public int getDaysInMonth()
- Get the number of days in this month
increment
public Date increment(int days)
- Increment the date by the selected number of days
decrement
public Date decrement(int days)
- Decrement the date by one day
getDayOfYear
public int getDayOfYear()
- Get the Julian day of this date
isLeapYear
public boolean isLeapYear(int year)
- Determines if the given year is a leap year. Returns true if the
given year is a leap year.
- Parameters:
- year - the given year.
- Returns:
- true if the given year is a leap year; false otherwise.
getDay
public int getDay()
- Returns the day of the week represented by this date. The value returned
is between
0 and 6, where 0
represents Sunday.
- Returns:
- the day of the week represented by this date.
getYear
public int getYear()
- Returns the year represented by this date, minus 1900.
- Returns:
- the year represented by this date, minus 1900.
setYear
public void setYear(int year)
- Sets the year of this date to be the specified value plus 1900.
- Parameters:
- year - the year value.
getMonth
public int getMonth()
- Returns the month represented by this date. The value returned is
between
0 and 11, with the value
0 representing January.
- Returns:
- the month represented by this date.
setMonth
public void setMonth(int month)
- Sets the month of this date to the specified value.
- Parameters:
- month - the month value between 0-11.
getDate
public int getDate()
- Returns the day of the month represented by this date. The value
returned is between
1 and 31.
- Returns:
- the day of the month represented by this date.
setDate
public void setDate(int date)
- Sets the day of the month of this date to the specified value.
- Parameters:
- date - the day of the month value between 1-31.
getJulianDate
public int getJulianDate()
- Returns the date in a psuedo Julian format. It is an integer
in the form yyyymmdd
- Returns:
- the date in a psuedo Julian format.
setJulianDate
public void setJulianDate(int juldate)
- Sets the date using a Julian format. The expected parameter
is an integer in the form yyyymmdd.
- Parameters:
- date - an integer in the form yyyymmdd.
equals
public boolean equals(Date date2)
- Compares two dates.
The result is
true if and only if the argument is
not null and is a Date object that
represents the same date, as this object.
- Parameters:
- date - the object to compare with.
- Returns:
-
true if the dates are the same;
false otherwise.
setDefaultFormat
public static void setDefaultFormat(String dateFormat)
- Set the default date format
- Parameters:
- dateFormat - the default date format
getDefaultFormat
public static String getDefaultFormat()
- Get the value of the date box
- Returns:
- the default date format
format
public static String format(String thisDate)
- Format a given date to the default format
- Parameters:
- date - the date to format
- Returns:
- the new newly formatted date
formatFromSystem
public static String formatFromSystem(String thisDate)
- Format a given date to the default format
- Parameters:
- date - the date to format
- Returns:
- the new newly formatted date
unformatFromSystem
public static Date unformatFromSystem(String thisDate)
- Format a given date to the default format
- Parameters:
- date - the date to format
- Returns:
- the new newly formatted date
format
public static String format(String thisDate,
String format)
- Format a given date to the default format
- Parameters:
- date - the date to format
- format - the format of the date (eg: "mm/dd/yy")
- Returns:
- the new newly formatted date
format
public static String format(Date thisDate)
- Format a given date to the default format
- Parameters:
- date - the date to format
- Returns:
- the new newly formatted date
format
public static String format(Date thisDate,
String format)
- Format a given date to a given format
- Parameters:
- date - the date to format
- format - the format of the date (eg: "mm/dd/yy")
- Returns:
- the new newly formatted date
formatForSql
public static String formatForSql(String thisDate,
int datasourceType)
- Format a given date string create the SQL to update it to the database
- Parameters:
- date - the date to parse
- datasourceType - the type of datasource we are writing to
- Returns:
- the SQL subclause
formatForSql
public static String formatForSql(String thisDate,
int datasourceType,
boolean showTime)
- Format a given date string create the SQL to update it to the database
- Parameters:
- date - the date to parse
- datasourceType - the type of datasource we are writing to
- showTime - include the time on the formatted SQL
- Returns:
- the SQL subclause
formatForSql
public static String formatForSql(Date thisDate,
int datasourceType)
- Format a given date string create the SQL to update it to the database
- Parameters:
- date - the date to parse
- datasourceType - the type of datasource we are writing to
- Returns:
- the SQL subclause
formatForSql
public static String formatForSql(Date thisDate,
int datasourceType,
boolean showTime)
- Format a given date string create the SQL to update it to the database
- Parameters:
- date - the date to parse
- datasourceType - the type of datasource we are writing to
- Returns:
- the SQL subclause
unformat
public static Date unformat(String thisDate)
- Format a given date string create a date using the default format
- Parameters:
- date - the date to parse
- Returns:
- the new date
unformat
public static Date unformat(String thisDate,
String format)
- Format a given date string create a date given the format
- Parameters:
- date - the date to parse
- format - the format of the date (eg: "mm/dd/yy")
- Returns:
- the new date
unformattedDateValid
public static boolean unformattedDateValid()
- Check whether the last date unformatted was invalid.
- Returns:
- whether the last date unformatted was invalid.
toString
public String toString()
- Overrides:
- toString in class Object
All Packages Class Hierarchy This Package Previous Next Index