Package ubic.basecode.util
Class DateUtil
java.lang.Object
ubic.basecode.util.DateUtil
Date Utility Class
- Version:
- $Revision$ $Date$
- Author:
- pavlidis, Matt Raible Modified by Dan Kibler to correct time pattern. Minutes should be mm not MM (MM is month).
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic final String
convertDateToString
(Date aDate) This method generates a string representation of a date based on the System Property 'dateFormat' in the format you specify on inputstatic final Date
convertStringToDate
(String aMask, String strDate) This method generates a string representation of a date/time in the format you specify on inputstatic final String
getDateTime
(String aMask, Date aDate) This method generates a string representation of a date's date/time in the format you specify on inputstatic Date
getRelativeDate
(Date date, String dateString) Turn a string like '-7d' into the date equivalent to "seven days ago".static String
getTodayDate
(boolean changeDateformat) return today date as a Stringstatic long
Compute the number of seconds spanned by the given dates.
-
Constructor Details
-
DateUtil
public DateUtil()
-
-
Method Details
-
convertDateToString
This method generates a string representation of a date based on the System Property 'dateFormat' in the format you specify on input- Parameters:
aDate
- A date to convert- Returns:
- a string representation of the date
-
convertStringToDate
This method generates a string representation of a date/time in the format you specify on input- Parameters:
aMask
- the date pattern the string is instrDate
- a string representation of a date- Returns:
- a converted Date object
- Throws:
ParseException
- See Also:
-
getDateTime
This method generates a string representation of a date's date/time in the format you specify on input- Parameters:
aMask
- the date pattern the string is inaDate
- a date object- Returns:
- a formatted string representation of the date
- See Also:
-
getRelativeDate
Turn a string like '-7d' into the date equivalent to "seven days ago". Supports 'd' for day, 'h' for hour, 'm' for minutes, "M" for months and "y" for years. Start with a '-' to indicate times in the past ('+' is not necessary for future). Values must be integers.- Parameters:
date
- to be added/subtracted todateString
-- Returns:
- Date relative to 'now' as modified by the input date string.
-
getTodayDate
return today date as a String- Parameters:
boolean
- changes character '\' to '-', (used to write files)- Returns:
- String today date
-
numberOfSecondsBetweenDates
Compute the number of seconds spanned by the given dates. If no or a single date is provided, returns 0.- Parameters:
dates
-- Returns:
-