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[] |
stringToTimestampFormats |
protected String |
timestampToStringFormatForFileName |
protected String |
timestampToStringFormatForUserInterface |
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.
|
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
|
protected String[] stringToDateFormats
protected String[] stringToTimestampFormats
protected String dateToStringFormatForUserInterface
protected String timestampToStringFormatForUserInterface
protected String dateToStringFormatForFileName
protected String timestampToStringFormatForFileName
public DateTimeServiceImpl()
public String toDateString(Date date)
DateTimeService
toDateString
in interface DateTimeService
DateTimeService.toDateString(java.util.Date)
public String toDateTimeString(Date date)
DateTimeService
toDateTimeString
in interface DateTimeService
DateTimeService.toDateTimeString(java.util.Date)
public String toString(Date date, String pattern)
DateTimeService
toString
in interface DateTimeService
DateTimeService.toString(java.util.Date,
java.lang.String)
public Date getCurrentDate()
DateTimeService
getCurrentDate
in interface DateTimeService
DateTimeService.getCurrentDate()
public Timestamp getCurrentTimestamp()
DateTimeService
getCurrentTimestamp
in interface DateTimeService
DateTimeService.getCurrentTimestamp()
public Date getCurrentSqlDate()
DateTimeService
getCurrentSqlDate
in interface DateTimeService
DateTimeService.getCurrentSqlDate()
public Date getCurrentSqlDateMidnight()
DateTimeService
getCurrentSqlDateMidnight
in interface DateTimeService
DateTimeService.getCurrentSqlDateMidnight()
public Calendar getCurrentCalendar()
DateTimeService
getCurrentCalendar
in interface DateTimeService
DateTimeService.getCurrentCalendar()
public Calendar getCalendar(Date date)
DateTimeService
getCalendar
in interface DateTimeService
DateTimeService.getCalendar(java.util.Date)
public Date convertToDate(String dateString) throws ParseException
convertToDate
in interface DateTimeService
ParseException
DateTimeService.convertToDate(java.lang.String)
public Date convertToDateTime(String dateTimeString) throws ParseException
DateTimeService
convertToDateTime
in interface DateTimeService
ParseException
DateTimeService.convertToDateTime(java.lang.String)
public Timestamp convertToSqlTimestamp(String timeString) throws ParseException
DateTimeService
convertToSqlTimestamp
in interface DateTimeService
ParseException
- if the string cannot be convertedDateTimeService.convertToSqlTimestamp(java.lang.String)
public Date convertToSqlDate(String dateString) throws ParseException
DateTimeService
convertToSqlDate
in interface DateTimeService
ParseException
- if the string cannot be convertedDateTimeService.convertToSqlDate(java.lang.String)
protected Date parseAgainstFormatArray(String dateString, String[] formats) throws ParseException
ParseException
public Date convertToSqlDate(Timestamp timestamp) throws ParseException
DateTimeService
convertToSqlDate
in interface DateTimeService
ParseException
DateTimeService.convertToSqlDate(java.sql.Timestamp)
public int dateDiff(Date startDate, Date endDate, boolean inclusive)
DateTimeService
dateDiff
in interface DateTimeService
startDate
- 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
ParseException
public String toDateStringForFilename(Date date)
DateTimeService
toDateStringForFilename
in interface DateTimeService
DateTimeService.toDateStringForFilename(java.util.Date)
public String toDateTimeStringForFilename(Date date)
DateTimeService
toDateTimeStringForFilename
in interface DateTimeService
DateTimeService.toDateTimeStringForFilename(java.util.Date)
public void afterPropertiesSet() throws Exception
afterPropertiesSet
in interface org.springframework.beans.factory.InitializingBean
Exception
InitializingBean.afterPropertiesSet()
Copyright © 2005–2016 The Kuali Foundation. All rights reserved.