public class DateUtil extends Object
Constructor and Description |
---|
DateUtil() |
Modifier and Type | Method and Description |
---|---|
static 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 input
|
static Date |
convertStringToDate(String aMask,
String strDate)
This method generates a string representation of a date/time in the format you specify on input
|
static String |
getDateTime(String aMask,
Date aDate)
This method generates a string representation of a date's date/time in the format you specify on input
|
static 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 String
|
static long |
numberOfSecondsBetweenDates(Collection<Date> dates)
Compute the number of seconds spanned by the given dates.
|
public static final String convertDateToString(Date aDate)
aDate
- A date to convertpublic static final Date convertStringToDate(String aMask, String strDate) throws ParseException
aMask
- the date pattern the string is instrDate
- a string representation of a dateParseException
SimpleDateFormat
public static final String getDateTime(String aMask, Date aDate)
aMask
- the date pattern the string is inaDate
- a date objectSimpleDateFormat
public static Date getRelativeDate(Date date, String dateString)
date
- to be added/subtracted todateString
- public static String getTodayDate(boolean changeDateformat)
boolean
- changes character '\' to '-', (used to write files)public static long numberOfSecondsBetweenDates(Collection<Date> dates)
dates
- Copyright © 2003–2023 UBC Michael Smith Laboratories. All rights reserved.