public class DateTimeServiceImpl extends Object implements DateTimeService, org.springframework.beans.factory.InitializingBean
| Modifier and Type | Field and Description |
|---|---|
protected String |
dateToStringFormatForFileName |
protected String |
dateToStringFormatForUserInterface |
protected String[] |
stringToDateFormats |
protected String[] |
stringToTimeFormats |
protected String[] |
stringToTimestampFormats |
protected String |
timestampToStringFormatForFileName |
protected String |
timestampToStringFormatForUserInterface |
protected String |
timeToStringFormatForUserInterface |
| Constructor and Description |
|---|
DateTimeServiceImpl() |
| Modifier and Type | Method and Description |
|---|---|
void |
afterPropertiesSet()
This overridden method ...
|
Date |
convertToDate(String dateString)
Formats strings into dates using the format string in the KR-NS/All/STRING_TO_DATE_FORMATS parameter
|
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.
|
Date |
convertToSqlDateUpperBound(String dateString)
Converts the given String into a java.sql.Date instance for the next day
|
Time |
convertToSqlTime(String timeString)
Converts the given String into a java.sql.Time instance
|
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 startDate,
Date endDate,
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
|
protected Date |
parse(String dateString,
String pattern) |
protected Date |
parseAgainstFormatArray(String dateString,
String[] formats) |
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
|
String |
toTimeString(Time time)
Translates the specified time into a string without a date component, formatted according to "stringTimeFormat" that the
service is configured with
|
protected String[] stringToDateFormats
protected String[] stringToTimeFormats
protected String[] stringToTimestampFormats
protected String dateToStringFormatForUserInterface
protected String timeToStringFormatForUserInterface
protected String timestampToStringFormatForUserInterface
protected String dateToStringFormatForFileName
protected String timestampToStringFormatForFileName
public DateTimeServiceImpl()
public String toDateString(Date date)
DateTimeServicetoDateString in interface DateTimeServiceDateTimeService.toDateString(java.util.Date)public String toTimeString(Time time)
DateTimeServicetoTimeString in interface DateTimeServiceDateTimeService.toTimeString(java.sql.Time)public String toDateTimeString(Date date)
DateTimeServicetoDateTimeString in interface DateTimeServiceDateTimeService.toDateTimeString(java.util.Date)public String toString(Date date, String pattern)
DateTimeServicetoString in interface DateTimeServiceDateTimeService.toString(java.util.Date,
java.lang.String)public Date getCurrentDate()
DateTimeServicegetCurrentDate in interface DateTimeServiceDateTimeService.getCurrentDate()public Timestamp getCurrentTimestamp()
DateTimeServicegetCurrentTimestamp in interface DateTimeServiceDateTimeService.getCurrentTimestamp()public Date getCurrentSqlDate()
DateTimeServicegetCurrentSqlDate in interface DateTimeServiceDateTimeService.getCurrentSqlDate()public Date getCurrentSqlDateMidnight()
DateTimeServicegetCurrentSqlDateMidnight in interface DateTimeServiceDateTimeService.getCurrentSqlDateMidnight()public Calendar getCurrentCalendar()
DateTimeServicegetCurrentCalendar in interface DateTimeServiceDateTimeService.getCurrentCalendar()public Calendar getCalendar(Date date)
DateTimeServicegetCalendar in interface DateTimeServiceDateTimeService.getCalendar(java.util.Date)public Date convertToDate(String dateString) throws ParseException
convertToDate in interface DateTimeServiceParseExceptionDateTimeService.convertToDate(java.lang.String)public Date convertToDateTime(String dateTimeString) throws ParseException
DateTimeServiceconvertToDateTime in interface DateTimeServiceParseExceptionDateTimeService.convertToDateTime(java.lang.String)public Timestamp convertToSqlTimestamp(String timeString) throws ParseException
DateTimeServiceconvertToSqlTimestamp in interface DateTimeServiceParseException - if the string cannot be convertedDateTimeService.convertToSqlTimestamp(java.lang.String)public Date convertToSqlDate(String dateString) throws ParseException
DateTimeServiceconvertToSqlDate in interface DateTimeServiceParseException - if the string cannot be convertedDateTimeService.convertToSqlDate(java.lang.String)public Date convertToSqlDateUpperBound(String dateString) throws ParseException
DateTimeServiceconvertToSqlDateUpperBound in interface DateTimeServiceParseException - if the string cannot be convertedDateTimeService.convertToSqlDateUpperBound(java.lang.String)public Time convertToSqlTime(String timeString) throws ParseException
DateTimeServiceconvertToSqlTime in interface DateTimeServiceParseException - if the string cannot be convertedDateTimeService.convertToSqlTime(java.lang.String)protected Date parseAgainstFormatArray(String dateString, String[] formats) throws ParseException
ParseExceptionpublic Date convertToSqlDate(Timestamp timestamp) throws ParseException
DateTimeServiceconvertToSqlDate in interface DateTimeServiceParseExceptionDateTimeService.convertToSqlDate(java.sql.Timestamp)public int dateDiff(Date startDate, Date endDate, boolean inclusive)
DateTimeServicedateDiff in interface DateTimeServicestartDate - The first date in the periodendDate - The second date in the periodinclusive - Whether the result should include both the start and the end date. Otherwise it only includes one.protected Date parse(String dateString, String pattern) throws ParseException
ParseExceptionpublic String toDateStringForFilename(Date date)
DateTimeServicetoDateStringForFilename in interface DateTimeServiceDateTimeService.toDateStringForFilename(java.util.Date)public String toDateTimeStringForFilename(Date date)
DateTimeServicetoDateTimeStringForFilename in interface DateTimeServiceDateTimeService.toDateTimeStringForFilename(java.util.Date)public void afterPropertiesSet() throws Exception
afterPropertiesSet in interface org.springframework.beans.factory.InitializingBeanExceptionInitializingBean.afterPropertiesSet()Copyright © 2005–2016 The Kuali Foundation. All rights reserved.