Constructor and Description |
---|
Date()
Constructs a new Date object, initialized with the current date.
|
Date(java.util.Calendar cal)
constructs a new date from a calendar object.
|
Date(java.io.DataInput in)
Deprecated.
since 3.0. use readData instead.
|
Date(Date d)
Constructs a new date from a date object, ie clones it.
|
Date(int year,
int month,
int dayOfMonth)
constructs a new date initialized with the given arguments.
|
Date(java.io.ObjectInputStream in)
Deprecated.
since 3.0, use readData instead
|
Date(short year,
byte month,
byte dayOfMonth)
constructs a new date initialized with the given arguments.
|
Modifier and Type | Method and Description |
---|---|
Date |
addDays(int days) |
int |
compareTo(Date otherDate) |
static Date |
createDateFromValue(long value)
create a date from a value (see getValue).
|
static Date |
createDDMMYYYY(java.lang.String date,
java.lang.String separator)
creates a date from a formatted string of the form DD<separator>MM<separator>YYYY.
|
static Date |
createYYMMDD(java.lang.String date,
java.lang.String separator)
creates a date from a formatted string of the form YY<separator>MM<separator>DD.
|
static Date |
createYYYYMMDD(java.lang.String date,
java.lang.String separator)
creates a date from a formatted string of the form YYYY<separator>MM<separator>DD.
|
boolean |
equals(java.lang.Object obj) |
java.util.Calendar |
getCalendar() |
java.util.Calendar |
getCalendar(java.util.Locale locale) |
static Date |
getCurrentDate()
do not call this method repeatedly!
|
java.lang.String |
getDateString()
return the textual representation of this date with abbreviated day of week
and abbreviated month name.
|
int |
getDayOfMonth() |
int |
getDayOfWeek()
get the day of the week for this date.
|
java.lang.String |
getFormattedString(java.lang.String pattern)
Returns a string of the date according to SimpleDateFormat
|
java.lang.String |
getFormattedString(java.lang.String pattern,
java.util.Locale locale)
Returns a string of the date according to SimpleDateFormat
|
java.lang.String |
getLongDateString()
return the textual representation of this date with full day of week
and full month name (neither abbreviated).
|
int |
getMonth() |
int |
getNumberOfDaysSince(Date date) |
java.lang.String |
getShortDayLongMonthString()
returns the textual representation of this date with abbreviated day of week, but full month.
|
long |
getValue()
TODO is that correct?
|
int |
getWeekOfYear()
Returns the week number within the current year.
|
int |
getWeekOfYear(java.util.Locale locale)
Returns the week number within the current year.
|
int |
getYear() |
int |
hashCode()
A hash code implementation that returns the same code for equal Dates.
|
boolean |
isFirstDayOfWeek()
ATTENTION: Altered with 3.4.4
is this the day of the week, which was setup as first
day of the week by the user or the default first day of
the week of the current Locale ?
|
boolean |
isFirstDayOfWeek(java.util.Locale locale)
is this the first day of the week?
|
static Date |
readData(java.io.DataInput in)
reads an instance from a DataInput.
|
static void |
resetLocalizer() |
java.lang.String |
toString() |
void |
writeData(java.io.DataOutput out)
Writes this instance to a DataOutput.
|
void |
writeData(java.io.ObjectOutputStream out)
Deprecated.
since 3.0
|
void |
writeToDataFile(java.io.RandomAccessFile out)
Deprecated.
since 3.0, use writeData instead
|
public Date()
public Date(short year, byte month, byte dayOfMonth)
year
- Calendar.get(Calendar.YEAR)month
- Calendar.get(Calendar.MONTH) + 1dayOfMonth
- Calendar.get(Calendar.DAY_OF_MONTH)public Date(int year, int month, int dayOfMonth)
year
- Calendar.get(Calendar.YEAR)month
- Calendar.get(Calendar.MONTH) + 1dayOfMonth
- Calendar.get(Calendar.DAY_OF_MONTH)public Date(java.util.Calendar cal)
cal
- the calendar to create a date from.public Date(Date d)
d
- the date to clone@Deprecated public Date(java.io.DataInput in) throws java.io.IOException, java.lang.ClassNotFoundException
in
- the input to read fromjava.io.IOException
- if the stream could not be readjava.lang.ClassNotFoundException
- if the date could not be restored@Deprecated public Date(java.io.ObjectInputStream in) throws java.io.IOException, java.lang.ClassNotFoundException
in
- the input to read fromjava.io.IOException
- if the stream could not be readjava.lang.ClassNotFoundException
- if the date could not be restoredpublic static Date getCurrentDate()
public static Date createDateFromValue(long value)
value
- the value to create a date frompublic static Date createYYYYMMDD(java.lang.String date, java.lang.String separator)
date
- the string to parse.separator
- the separator separating the year, month and day sections of the stringpublic static Date createDDMMYYYY(java.lang.String date, java.lang.String separator)
date
- the string to parse.separator
- the separator separating the year, month and day sections of the stringpublic static Date createYYMMDD(java.lang.String date, java.lang.String separator)
date
- the string to parse.separator
- the separator separating the year, month and day sections of the stringpublic int getNumberOfDaysSince(Date date)
date
- The date to check for days since.public int getYear()
public int getMonth()
public int getDayOfMonth()
public int getWeekOfYear()
public int getWeekOfYear(java.util.Locale locale)
locale
- The locale to be used@Deprecated public void writeToDataFile(java.io.RandomAccessFile out) throws java.io.IOException
out
- the file to write tojava.io.IOException
- if something went wrong@Deprecated public void writeData(java.io.ObjectOutputStream out) throws java.io.IOException
out
- the stream to write tojava.io.IOException
- if something went wrongpublic int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
Object.equals(java.lang.Object)
public java.lang.String getDateString()
public java.lang.String getFormattedString(java.lang.String pattern)
pattern
- the pattern describing the date and time formatpublic java.lang.String getFormattedString(java.lang.String pattern, java.util.Locale locale)
pattern
- the pattern describing the date and time formatlocale
- the locale whose date format symbols should be usedpublic java.lang.String getLongDateString()
public java.lang.String getShortDayLongMonthString()
public long getValue()
public java.util.Calendar getCalendar()
public java.util.Calendar getCalendar(java.util.Locale locale)
locale
- public java.lang.String toString()
toString
in class java.lang.Object
public Date addDays(int days)
days
- the days to addpublic int compareTo(Date otherDate)
compareTo
in interface java.lang.Comparable<Date>
Comparable.compareTo(java.lang.Object)
public int getDayOfWeek()
public boolean isFirstDayOfWeek()
true
, if this is the first day of the week.public boolean isFirstDayOfWeek(java.util.Locale locale)
locale
- The locale to be usedtrue
, if this is the first day of the weekpublic void writeData(java.io.DataOutput out) throws java.io.IOException
out
- the output to write tojava.io.IOException
- if something went wrongpublic static Date readData(java.io.DataInput in) throws java.io.IOException
in
- the input to read fromjava.io.IOException
- if somethin went wrongpublic static void resetLocalizer()
TV-Browser 3.4.4, Copyright (C) 2004-2008 TV-Browser Team (dev@tvbrowser.org)