Package ghidra.util
Class DateUtils
- java.lang.Object
-
- ghidra.util.DateUtils
-
public class DateUtils extends java.lang.Object
-
-
Field Summary
Fields Change Modifier and Type Field Description static longMS_PER_DAYstatic longMS_PER_HOURstatic longMS_PER_MINstatic longMS_PER_SEC
-
Constructor Summary
Constructors Change Constructor Description DateUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Change Modifier and Type Method Description NEW static java.lang.StringformatCurrentTime()Returns the current local time zone time-of-day as simple time string.static java.lang.StringformatDate(java.util.Date date)Formats the given date into a string.NEW static java.lang.StringformatDateTimestamp(java.util.Date date)Formats the given date into a string that contains the date and time.static java.lang.StringformatDuration(long millis)Formats a millisecond duration as a English string expressing the number of hours, minutes and seconds in the durationNEW static intgetBusinessDaysBetween(java.util.Date date1, java.util.Date date2)Returns the business days between the two dates.static java.util.DategetDate(int year, int month, int day)Returns a date for the given numeric valuesstatic intgetDaysBetween(java.util.Date date1, java.util.Date date2)Returns all days between the two dates.static java.util.List<java.util.Date>getHolidays(int year)static java.util.DategetNormalizedToday()static booleanisHoliday(java.util.Calendar cal)static booleanisHoliday(java.util.Date date)static booleanisWeekend(java.util.Calendar cal)static java.util.DatenormalizeDate(java.util.Date date)REMOVED StringgetTimeNow() (Removed)
-
-
-
Field Detail
-
MS_PER_SEC
public static final long MS_PER_SEC
- See Also:
- Constant Field Values
-
MS_PER_MIN
public static final long MS_PER_MIN
- See Also:
- Constant Field Values
-
MS_PER_HOUR
public static final long MS_PER_HOUR
- See Also:
- Constant Field Values
-
MS_PER_DAY
public static final long MS_PER_DAY
- See Also:
- Constant Field Values
-
-
Method Detail
-
getHolidays
public static java.util.List<java.util.Date> getHolidays(int year)
-
isHoliday
public static boolean isHoliday(java.util.Date date)
-
getNormalizedToday
public static java.util.Date getNormalizedToday()
-
isHoliday
public static boolean isHoliday(java.util.Calendar cal)
-
isWeekend
public static boolean isWeekend(java.util.Calendar cal)
-
normalizeDate
public static java.util.Date normalizeDate(java.util.Date date)
-
formatDate
public static java.lang.String formatDate(java.util.Date date)
Formats the given date into a string. This is in contrast toformatDateTimestamp(Date), which will also return the time portion of the date.- Parameters:
date- the date to format- Returns:
- the date string
-
formatDateTimestamp NEW
public static java.lang.String formatDateTimestamp(java.util.Date date)
Formats the given date into a string that contains the date and time. This is in contrast toformatDate(Date), which only returns a date string.- Parameters:
date- the date to format- Returns:
- the date and time string
-
formatCurrentTime NEW
public static java.lang.String formatCurrentTime()
Returns the current local time zone time-of-day as simple time string. See "h:mm".- Returns:
- current time-of-day a a string
-
getDate
public static java.util.Date getDate(int year, int month, int day)Returns a date for the given numeric values- Parameters:
year- the yearmonth- the month; 0-basedday- the day of month; 1-based- Returns:
- the date
-
getDaysBetween
public static int getDaysBetween(java.util.Date date1, java.util.Date date2)Returns all days between the two dates. Returns 0 if the same date is passed for both parameters. The order of the dates does not matter.- Parameters:
date1- the first datedate2- the second date- Returns:
- the number of days
-
getBusinessDaysBetween NEW
public static int getBusinessDaysBetween(java.util.Date date1, java.util.Date date2)Returns the business days between the two dates. Returns 0 if the same date is passed for both parameters. The order of the dates does not matter.- Parameters:
date1- the first datedate2- the second date- Returns:
- the number of days
-
formatDuration
public static java.lang.String formatDuration(long millis)
Formats a millisecond duration as a English string expressing the number of hours, minutes and seconds in the duration- Parameters:
millis- Count of milliseconds of an elapsed duration.- Returns:
- String such as "5 hours, 3 mins, 22 secs".
-
-