Package com.thepluginpeople.jemhod.api
Interface ITemplateDateUtils
public interface ITemplateDateUtils
-
Method Summary
Modifier and TypeMethodDescriptionAdds a number of days to a value (date, string, number or json node with an string or number) returning a new date.Adds a number of hours to a value (date, string, number or json node with an string or number) returning a new date.addMinutes
(Object value, int minutes) Adds a number of minutes to a value (date, string, number or json node with an string or number) returning a new date.Adds a number of months to a value (date, string, number or json node with an string or number) returning a new date.Adds a number of weeks to a value (date, string, number or json node with an string or number) returning a new date.createDate
(Long date) Allocates aDate
object and initializes it to represent the specified number of milliseconds since the standard base time known as "the epoch", namely January 1, 1970, 00:00:00 GMT.Returns a date from an object.getZonedDateTime
(String text) Converts the given date-time text of the patternyyyy-MM-dd'T'HH:mm:ss.SSSZ
(for example,"2021-07-12T13:22:53.744+0100"
) to a user friendly type.nowDate()
Now date.truncateMinute
(Date date) Returns the date without truncating the minute.
-
Method Details
-
nowDate
Date nowDate()Now date.- Returns:
- a date with the current time.
-
truncateMinute
Returns the date without truncating the minute.- Parameters:
date
- the date- Returns:
- same date with 0 seconds
-
createDate
Allocates aDate
object and initializes it to represent the specified number of milliseconds since the standard base time known as "the epoch", namely January 1, 1970, 00:00:00 GMT.- Parameters:
date
- the milliseconds since January 1, 1970, 00:00:00 GMT.- Returns:
- the date
- See Also:
-
getDate
Returns a date from an object. The object could be a date, a number, a string or a json node with a string or a number.- Parameters:
value
- a date, string, number or a json node containing a number or a string.- Returns:
- a date or null if the date could not be resolved.
-
addMinutes
Adds a number of minutes to a value (date, string, number or json node with an string or number) returning a new date. The originalDate
is unchanged.- Parameters:
value
- the date or nullminutes
- the amount to add, may be negative- Returns:
- the new
Date
with the minutes added or null if the date could not be resolved from the original value.
-
addHours
Adds a number of hours to a value (date, string, number or json node with an string or number) returning a new date. The originalDate
is unchanged.- Parameters:
value
- the date or nullhours
- the amount to add, may be negative- Returns:
- the new
Date
with the hours added or null if the date could not be resolved from the original value.
-
addDays
Adds a number of days to a value (date, string, number or json node with an string or number) returning a new date. The originalDate
is unchanged.- Parameters:
value
- the date or nulldays
- the amount to add, may be negative- Returns:
- the new
Date
with the days added or null if the date could not be resolved from the original value.
-
addWeeks
Adds a number of weeks to a value (date, string, number or json node with an string or number) returning a new date. The originalDate
is unchanged.- Parameters:
value
- the date or nullweeks
- the amount to add, may be negative- Returns:
- the new
Date
with the weeks added or null if the date could not be resolved from the original value.
-
addMonths
Adds a number of months to a value (date, string, number or json node with an string or number) returning a new date. The originalDate
is unchanged.- Parameters:
value
- the date or nullmonths
- the amount to add, may be negative- Returns:
- the new
Date
with the months added or null if the date could not be resolved from the original value.
-
getZonedDateTime
Converts the given date-time text of the patternyyyy-MM-dd'T'HH:mm:ss.SSSZ
(for example,"2021-07-12T13:22:53.744+0100"
) to a user friendly type.- Parameters:
text
- the date-time with time-zone represented as text- Returns:
- the
ZonedDateTime
representing the given string, or null if it does not match the stated pattern.
-