public class DateHelper extends Object
| Modifier and Type | Field and Description |
|---|---|
static String |
CONFIG_DATE_CURRENT_ZONE |
static String |
CONFIG_DATE_FORMAT |
static String |
CONFIG_DATE_FORMAT_DEFAULT |
static String |
CONFIG_DATE_LOCAL |
static String |
CONFIG_DATE_OUTPUT_ZONE |
static String |
CONFIG_DATE_ZONE_INPUT_DEFAULT |
static String |
CONFIG_DATE_ZONE_OUTPUT_DEFAULT |
| Constructor and Description |
|---|
DateHelper() |
| Modifier and Type | Method and Description |
|---|---|
String |
getCurrentTime(Locale locale)
get current time based on locale
|
String |
getCurrentTime(String format)
get current time based on format
|
String |
getCurrentTime(String format,
String currentZone)
get current time based on format and time zone
output zone will be UTC
|
String |
getCurrentTime(String format,
String currentZone,
String outputZone,
Locale locale)
get current time based on locale
|
String |
getCurrentTimeEpochMS() |
String |
getCurrentTimeEpochSeconds() |
int |
getDayOfWeekIndex(LocalDateTime time)
get day of week
|
int |
getDayOfWeekIndex(String day)
get day of week
|
LocalDateTime |
getLocalDateTime(String timeString)
get local date time from date string
|
int |
getMonthOfYearIndex(LocalDateTime time)
get month of year
|
int |
getMonthOfYearIndex(String month)
get month of year
|
String |
getTime(Instant time)
get time string
output time zone will be UTC by default
|
String |
getTime(Instant time,
Locale locale)
get time based on locale
output time zone will be UTC by default
|
String |
getTime(Instant time,
String format)
get time based on format
output time zone will be UTC by default
|
String |
getTime(Instant time,
String format,
Locale locale)
get time based on format
output time zone will be UTC by default
|
String |
getTime(Instant time,
String format,
String zone)
get time based on format
output time zone will be UTC by default
|
String |
getTime(Instant time,
String format,
String zone,
Locale locale)
get time based on format
output time zone will be UTC by default
|
String |
getTime(Instant time,
String format,
String currentZone,
String outputZone,
Locale locale)
get time based on format
|
String |
getTime(String parameter,
String timeString)
get time based time modification, format or fixed time eg.
|
String |
getTime(String timeString,
String format,
String zone)
get time based on format and time zone
|
String |
getTime(String timeString,
String format,
String outputZone,
String zone)
get time based on format and time zone
|
String |
getTime(String timeString,
String format,
String zone,
String outputZone,
Locale locale)
get time based on format and time zone
|
String |
getTimeEpochMS(ZonedDateTime time) |
String |
getTimeInstance() |
String |
getTimeISOInstant() |
String |
getTimestampMiliseconds() |
String |
getTimestampSeconds() |
String |
getTimeString(String timeString,
String format,
String zone,
String outputZone,
String localeStr) |
String |
getTimeWithModification(String parameter,
String timeString)
time: _TIME_STRING_17-72h or _TIME_STRING_17+72h
|
boolean |
isBetweenDates(List<String> sources,
String date1,
String date2)
are source dates between date1 and date2
|
boolean |
isBetweenDates(String source,
String date1,
String date2)
is source date between date1 and date2
|
boolean |
isDateAfter(List<String> sources,
String date1)
if date list is after target date1
|
boolean |
isDateAfter(String source,
String date1)
if date is after target date1
|
boolean |
isDateBefore(List<String> sources,
String date1)
if date list is before date1
|
boolean |
isDateBefore(String source,
String date1)
if date list is before date1
|
boolean |
isDateEqual(List<String> sources,
String target)
is source string eqia; target date string
|
boolean |
isDateEqual(String source,
String target)
is source string equal target date string
|
boolean |
isDateNotEqual(List<String> sources,
String target)
is source string not equal target date string
|
boolean |
isDateNotEqual(String source,
String target)
is source string not equal target date string
|
String |
removeFirstAndLastChars(String value,
String... toRemove)
removes surrounding character from string
|
String |
setDay(String dayName,
String timeString)
set day based on format setDay:Day
|
String |
setInitialDate(String parameter)
set time to time
overwrites the TestObject.START_TIME_STRING value
|
String |
setMonth(String monthName,
String timeString)
set month based on format setMonth:Month
|
String |
setTime(String parameter,
String timeString)
sets time based on format: setTime:hh:mm:ss eg: 14:42:33 any combination will
work uses utc zone to set time
|
String |
setTimeParameterFormat(String parameter)
setTime, setDay, setMonth parameters at beginning of date modification list
|
public static final String CONFIG_DATE_FORMAT
public static final String CONFIG_DATE_CURRENT_ZONE
public static final String CONFIG_DATE_OUTPUT_ZONE
public static final String CONFIG_DATE_LOCAL
public static final String CONFIG_DATE_FORMAT_DEFAULT
public static final String CONFIG_DATE_ZONE_INPUT_DEFAULT
public static final String CONFIG_DATE_ZONE_OUTPUT_DEFAULT
public String getTimestampMiliseconds()
public String getCurrentTimeEpochSeconds()
public String getCurrentTimeEpochMS()
public String getTimeEpochMS(ZonedDateTime time)
public String getTimeInstance()
public String getTimestampSeconds()
public String getTimeISOInstant()
public String getCurrentTime(String format, String currentZone)
format - zone - public String getCurrentTime(String format)
format - public String getCurrentTime(Locale locale)
format - public String getCurrentTime(String format, String currentZone, String outputZone, Locale locale)
format - public String getTime(Instant time)
time - format - public String getTime(Instant time, Locale locale)
time - format - public String getTime(Instant time, String format)
time - format - public String getTime(Instant time, String format, Locale locale)
time - format - public String getTime(Instant time, String format, String zone)
time - format - public String getTime(Instant time, String format, String zone, Locale locale)
time - format - public String getTime(Instant time, String format, String currentZone, String outputZone, Locale locale)
time - format - public String getTime(String timeString, String format, String zone)
time - format - zone - public String getTime(String timeString, String format, String outputZone, String zone)
time - format - zone - public String getTimeString(String timeString, String format, String zone, String outputZone, String localeStr)
public String getTime(String timeString, String format, String zone, String outputZone, Locale locale)
time - format - zone - public int getDayOfWeekIndex(String day)
day - public int getDayOfWeekIndex(LocalDateTime time)
time - public int getMonthOfYearIndex(String month)
time - public int getMonthOfYearIndex(LocalDateTime time)
time - public boolean isBetweenDates(String source, String date1, String date2)
source - date1 - date2 - public boolean isBetweenDates(List<String> sources, String date1, String date2)
sources - date1 - date2 - public boolean isDateAfter(String source, String date1)
source - date1 - public boolean isDateAfter(List<String> sources, String date1)
source - date1 - public boolean isDateBefore(String source, String date1)
source - date1 - public boolean isDateBefore(List<String> sources, String date1)
source - date1 - public boolean isDateEqual(String source, String target)
source - target - public boolean isDateEqual(List<String> sources, String target)
sources - date1 - public boolean isDateNotEqual(String source, String target)
source - target - public boolean isDateNotEqual(List<String> sources, String target)
sources - date1 - public LocalDateTime getLocalDateTime(String timeString)
timeString - public String getTime(String parameter, String timeString)
parameter - timeString - public String setTimeParameterFormat(String parameter)
parameter - public String setInitialDate(String parameter)
parameter - public String setTime(String parameter, String timeString)
parameter - timeString - public String setDay(String dayName, String timeString)
parameter - timeString - public String setMonth(String monthName, String timeString)
monthName - timeString - public String removeFirstAndLastChars(String value, String... toRemove)
value - toRemove - Copyright © 2020. All rights reserved.