|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface DateTimeService
This interface defines methods that a DateTime service must provide
Method Summary | |
---|---|
Date |
convertToDate(String dateString)
Translates the specified string into a date without a time component, see implementation class for formatting details |
Date |
convertToDateTime(String dateTimeString)
Translates the specified string into a date with a time component, formatted according to "stringDateTimeFormat" that the service is configured with |
Date |
convertToSqlDate(String dateString)
Converts the given String into a java.sql.Date instance |
Date |
convertToSqlDate(Timestamp timestamp)
Converts a Timestamp into a sql Date. |
Timestamp |
convertToSqlTimestamp(String timeString)
Converts the given String into a java.sql.Timestamp instance according to the "stringDateTimeFormat" that the service is configured with |
int |
dateDiff(Date date1,
Date date2,
boolean inclusive)
Returns the number of days between two days - start and end date of some arbitrary period. |
Calendar |
getCalendar(Date date)
Returns a Calendar initialized to the given Date |
Calendar |
getCurrentCalendar()
Returns a Calendar initialized with the current Date |
Date |
getCurrentDate()
Returns the current date/time as a java.util.Date |
Date |
getCurrentSqlDate()
Returns the current date/time as a java.sql.Date |
Date |
getCurrentSqlDateMidnight()
Returns the current date as a java.sql.Date rounded back to midnight. |
Timestamp |
getCurrentTimestamp()
Returns the current date/time as a java.sql.Timestamp |
String |
toDateString(Date date)
Translates the specified date into a string without a time component, formatted according to "stringDateFormat" that the service is configured with |
String |
toDateStringForFilename(Date date)
Returns a String representing a date that is suitable for file names, and is preferably chronologically sortable |
String |
toDateTimeString(Date date)
Translates the specified date into a string with a time component, formatted according to the "stringDateTimeFormat" that the service is configured with |
String |
toDateTimeStringForFilename(Date date)
Returns a String representing a date/time that is suitable for file names, and is preferably chronologically sortable |
String |
toString(Date date,
String pattern)
Translates the specified date into a string without a time component, formatted according to the specified pattern |
Method Detail |
---|
String toDateString(Date date)
date
-
String toDateTimeString(Date date)
date
-
String toString(Date date, String pattern)
date
-
Date getCurrentDate()
Timestamp getCurrentTimestamp()
Date getCurrentSqlDate()
Date getCurrentSqlDateMidnight()
Calendar getCurrentCalendar()
Calendar getCalendar(Date date)
IllegalArgumentException
- if the given Date is nullDate convertToDate(String dateString) throws ParseException
dateString
-
ParseException
Date convertToDateTime(String dateTimeString) throws ParseException
dateTimeString
-
ParseException
Timestamp convertToSqlTimestamp(String timeString) throws ParseException
timeString
-
IllegalArgumentException
- if the given string is null or blank
ParseException
- if the string cannot be convertedDate convertToSqlDate(String dateString) throws ParseException
dateString
-
IllegalArgumentException
- if the given string is null or blank
ParseException
- if the string cannot be convertedDate convertToSqlDate(Timestamp timestamp) throws ParseException
timestamp
-
ParseException
int dateDiff(Date date1, Date date2, boolean inclusive)
date1
- The first date in the perioddate2
- The second date in the periodinclusive
- Whether the result should include both the start and the end date. Otherwise it only includes one.
String toDateStringForFilename(Date date)
date
-
String toDateTimeStringForFilename(Date date)
date
-
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |