Package com.codetaco.date
Class CalendarFactory
- java.lang.Object
-
- com.codetaco.date.CalendarFactory
-
public class CalendarFactory extends Object
Each of the methods in this class allows for some type of converstion from or to a ZonedDateTime.Many of the methods allow for adjustments to be applied to the date as it is converted. These adjustments are an array, or a space separated string, of patterns to be applied in order to the supplied date / time.
Each pattern consists of 3 parts, a direction, a quantity, and a unit of measure. An example would be
+3Months
or=4DayOfWeek
. There can be no whitespace within a pattern.For specifics and examples see the documentation.
Direction
A direction can be one of "+", "-", or "=". Relative (or sliding) directions can be one of ">", ">=, "<", or "<=".Quantity
The quantity can be one of an integer, "B", or "E".Unit of measure
The unit of measure can be one of "Year", "Month", "Day", "DayOfWeek", "Hour", "Minute", "Second", "Millisecond", "NanoSecond", or "Time".Some of the methods convert Strings to various date formats. These Strings can be any well known format of date / time.
-
-
Constructor Summary
Constructors Constructor Description CalendarFactory()
-
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static Calendar
asCalendar(long epochMillisecond, String... adjustmentsArray)
Convert epoch milliseconds to a Calendar instance while optionally applying adjustments.static Calendar
asCalendar(String dateTime, String... adjustmentsArray)
Convert a String date time to a Calendar instance while optionally applying adjustments.static Calendar
asCalendar(LocalDate date, String... adjustmentsArray)
Convert a local date to a Calendar instance while optionally applying adjustments.static Calendar
asCalendar(LocalDateTime dateTime, String... adjustmentsArray)
Convert a local date time to a Calendar instance while optionally applying adjustments.static void
asCalendar(LocalTime time, String... adjustmentsArray)
Deprecated.static Calendar
asCalendar(ZonedDateTime zonedDateTime, String... adjustmentsArray)
Convert a ZonedDateTime to a Calendar instance while optionally applying adjustments.static Calendar
asCalendar(Calendar calendar, String... adjustmentsArray)
Convert a calendar to a Calendar instance while optionally applying adjustments.static Calendar
asCalendar(Date date, String... adjustmentsArray)
Convert a date to a Calendar instance while optionally applying adjustments.static Date
asDate(long epochMillisecond, String... adjustmentsArray)
Convert epoch milliseconds to a Date instance while optionally applying adjustments.static Date
asDate(String dateTime, String... adjustmentsArray)
Convert a String date time to a Date instance while optionally applying adjustments.static Date
asDate(LocalDate date, String... adjustmentsArray)
Convert a local date to a Date instance while optionally applying adjustments.static Date
asDate(LocalDateTime dateTime, String... adjustmentsArray)
Convert a local date time to a Date instance while optionally applying adjustments.static void
asDate(LocalTime time, String... adjustmentsArray)
Deprecated.static Date
asDate(ZonedDateTime zonedDateTime, String... adjustmentsArray)
Convert a ZonedDateTime to a Date instance while optionally applying adjustments.static Date
asDate(Calendar calendar, String... adjustmentsArray)
Convert a calendar to a Date instance while optionally applying adjustments.static Date
asDate(Date date, String... adjustmentsArray)
Convert a date to a Date instance while optionally applying adjustments.static long
asDateLong(long epochMillisecond, String... adjustmentsArray)
Convert epoch milliseconds to epoch milliseconds while removing the time part and optionally applying adjustments.static long
asDateLong(String dateTime, String... adjustmentsArray)
Convert a String date time to an epoch milliseconds of only the date part while optionally applying adjustments.static long
asDateLong(LocalDate date, String... adjustmentsArray)
Convert a local date to an epoch milliseconds while removing the time part and optionally applying adjustments.static long
asDateLong(LocalDateTime dateTime, String... adjustmentsArray)
Convert a local date time to an epoch milliseconds while removing the time part and optionally applying adjustments.static void
asDateLong(LocalTime time, String... adjustmentsArray)
Deprecated.static long
asDateLong(ZonedDateTime zonedDateTime, String... adjustmentsArray)
Convert a ZonedDateTime to a epoch milliseconds while removing the time part and optionally applying adjustments.static long
asDateLong(Calendar calendar, String... adjustmentsArray)
Convert a date to an epoch milliseconds while removing the time part and optionally applying adjustments.static long
asDateLong(Date date, String... adjustmentsArray)
Convert a date to an epoch milliseconds while removing the time part and optionally applying adjustments.static String
asFormula(long epochMillisecond, String... adjustmentsArray)
Convert epoch milliseconds to a list of adjustments while optionally applying adjustments.static String
asFormula(String dateTime, String... adjustmentsArray)
Convert a String date time to a list of adjustments while optionally applying adjustments.static String
asFormula(LocalDate date, String... adjustmentsArray)
Convert a local date to a list of adjustments while optionally applying adjustments.static String
asFormula(LocalDateTime dateTime, String... adjustmentsArray)
Convert a local date time to a list of adjustments while optionally applying adjustments.static void
asFormula(LocalTime time, String... adjustmentsArray)
Deprecated.static String
asFormula(ZonedDateTime zonedDateTime, String... adjustmentsArray)
Convert a Zoned date time to a list of adjustments while optionally applying adjustments.static String
asFormula(Calendar calendar, String... adjustmentsArray)
Convert a calendar to a list of adjustments while optionally applying adjustments.static String
asFormula(Date date, String... adjustmentsArray)
Convert a date instance to a list of adjustments while optionally applying adjustments.static String
asJSON(long epochMillisecond, String... adjustmentsArray)
Convert epoch milliseconds to a JSON formatted String while optionally applying adjustments.static String
asJSON(String dateTime, String... adjustmentsArray)
Convert a String date time to a JSON formatted date / time while optionally applying adjustments.static String
asJSON(LocalDate date, String... adjustmentsArray)
Convert a local date to a JSON formatted String while optionally applying adjustments.static String
asJSON(LocalDateTime ldt, String... adjustmentsArray)
Convert a local date time to a JSON formatted String while optionally applying adjustments.static String
asJSON(LocalTime time, String... adjustmentsArray)
As json string.static String
asJSON(ZonedDateTime zonedDateTime, String... adjustmentsArray)
Convert a Zoned date time to a JSON formatted String while optionally applying adjustments.static String
asJSON(Calendar calendar, String... adjustmentsArray)
Convert a calendar to a JSON formatted String while optionally applying adjustments.static String
asJSON(Date date, String... adjustmentsArray)
Convert a date to a JSON formatted String while optionally applying adjustments.static LocalDate
asLocalDate(long epochMillisecond, String... adjustmentsArray)
Convert epoch milliseconds to a LocalDate instance while optionally applying adjustments.static LocalDate
asLocalDate(String dateTime, String... adjustmentsArray)
Convert a String date time to a LocalDate instance while optionally applying adjustments.static LocalDate
asLocalDate(LocalDate date, String... adjustmentsArray)
Convert a local date to a LocalDate instance while optionally applying adjustments.static LocalDate
asLocalDate(LocalDateTime dateTime, String... adjustmentsArray)
Convert a local date time to a LocalDate instance while optionally applying adjustments.static void
asLocalDate(LocalTime time, String... adjustmentsArray)
Deprecated.static LocalDate
asLocalDate(ZonedDateTime zonedDateTime, String... adjustmentsArray)
Convert a Zoned date time to a LocalDate while optionally applying adjustments.static LocalDate
asLocalDate(Calendar calendar, String... adjustmentsArray)
Convert a calendar to a LocalDate instance while optionally applying adjustments.static LocalDate
asLocalDate(Date date, String... adjustmentsArray)
Convert a date to a LocalDate instance while optionally applying adjustments.static LocalDateTime
asLocalDateTime(long epochMillisecond, String... adjustmentsArray)
Convert epoch milliseconds to a LocalDateTime instance while optionally applying adjustments.static LocalDateTime
asLocalDateTime(String dateTime, String... adjustmentsArray)
Convert a String date time to a LocalDateTime instance while optionally applying adjustments.static LocalDateTime
asLocalDateTime(LocalDate dateTime, String... adjustmentsArray)
Convert a local date to a LocalDate instance while optionally applying adjustments.static LocalDateTime
asLocalDateTime(LocalDateTime dateTime, String... adjustmentsArray)
Convert a local date time to a LocalDateTime instance while optionally applying adjustments.static void
asLocalDateTime(LocalTime time, String... adjustmentsArray)
Deprecated.static LocalDateTime
asLocalDateTime(ZonedDateTime zonedDateTime, String... adjustmentsArray)
Convert a zoned date time to a LocalDateTime instance while optionally applying adjustments.static LocalDateTime
asLocalDateTime(Calendar calendar, String... adjustmentsArray)
Convert a calendar to a LocalDateTime instance while optionally applying adjustments.static LocalDateTime
asLocalDateTime(Date date, String... adjustmentsArray)
Convert a date to a LocalDateTime instance while optionally applying adjustments.static LocalTime
asLocalTime(long epochMillisecond, String... adjustmentsArray)
Convert epoch milliseconds to a LocalTime instance while optionally applying adjustments.static LocalTime
asLocalTime(String dateTime, String... adjustmentsArray)
Convert a String date time to a LocalTime instance while optionally applying adjustments.static LocalTime
asLocalTime(LocalDate date, String... adjustmentsArray)
Convert a local date to a LocalTime instance while optionally applying adjustments.static LocalTime
asLocalTime(LocalDateTime dateTime, String... adjustmentsArray)
Convert a local date time to a LocalTime instance while optionally applying adjustments.static LocalTime
asLocalTime(LocalTime time, String... adjustmentsArray)
As local time local time.static LocalTime
asLocalTime(ZonedDateTime zonedDateTime, String... adjustmentsArray)
Convert a Zoned date time to a LocalTime while optionally applying adjustments.static LocalTime
asLocalTime(Calendar calendar, String... adjustmentsArray)
Convert a calendar to a LocalTime instance while optionally applying adjustments.static LocalTime
asLocalTime(Date date, String... adjustmentsArray)
Convert a date to a LocalTime instance while optionally applying adjustments.static long
asLong(long epochMillisecond, String... adjustmentsArray)
Convert epoch milliseconds to an epoch milliseconds while optionally applying adjustments.static long
asLong(String dateTime, String... adjustmentsArray)
Convert a String date time to an epoch milliseconds while optionally applying adjustments.static long
asLong(LocalDate date, String... adjustmentsArray)
Convert a local date to a epoch milliseconds while optionally applying adjustments.static long
asLong(LocalDateTime dateTime, String... adjustmentsArray)
Convert a local date time to an epoch milliseconds while optionally applying adjustments.static void
asLong(LocalTime time, String... adjustmentsArray)
Deprecated.static long
asLong(ZonedDateTime zonedDateTime, String... adjustmentsArray)
Convert a Zoned date time to a epoch milliseconds while optionally applying adjustments.static long
asLong(Calendar calendar, String... adjustmentsArray)
Convert a calendar to an epoch milliseconds while removing the time part and optionally applying adjustments.static long
asLong(Date date, String... adjustmentsArray)
Convert a date to an epoch milliseconds while optionally applying adjustments.static ZonedDateTime
asZoned(long epochMillisecond, String... adjustmentsArray)
Convert epoch milliseconds to a ZonedDateTime instance while optionally applying adjustments.static ZonedDateTime
asZoned(String datetime, String... adjustmentsArray)
Convert a String date time to a ZonedDateTime instance while optionally applying adjustments.static ZonedDateTime
asZoned(LocalDate date, String... adjustmentsArray)
Convert a local date to a ZonedDateTime instance while optionally applying adjustments.static ZonedDateTime
asZoned(LocalDateTime dateTime, String... adjustmentsArray)
Convert a local date time to a ZonedDateTime instance while optionally applying adjustments.static ZonedDateTime
asZoned(LocalTime time, String... adjustmentsArray)
As zoned zoned date time.static ZonedDateTime
asZoned(ZonedDateTime dateTime, String... adjustmentsArray)
Convert a Zoned date time to a ZonedDateTime while optionally applying adjustments.static ZonedDateTime
asZoned(Calendar calendar, String... adjustmentsArray)
Convert a calendar to a ZonedDateTime instance while optionally applying adjustments.static ZonedDateTime
asZoned(Date date, String... adjustmentsArray)
Convert a date to a ZonedDateInstance instance while optionally applying adjustments.static ICalendarFactory
getInstance()
Gets instance.static boolean
isInDebug()
Is in debug boolean.static ZonedDateTime
noTime(long epochMillisecond, String... adjustmentsArray)
Convert epoch milliseconds to a ZonedDateTime instance while removing the time part and optionally applying adjustments.static ZonedDateTime
noTime(String startingDateTime, String... adjustmentsArray)
Convert a String date time to a ZonedDateTime instance while removing the time portion and optionally applying adjustments.static ZonedDateTime
noTime(LocalDate startingDate, String... adjustmentsArray)
Convert a local date to a ZonedDateTime instance while removing the time part and optionally applying adjustments.static ZonedDateTime
noTime(LocalDateTime startingDateTime, String... adjustmentsArray)
Convert a local date time to a ZonedDateTime instance while removing the time part and optionally applying adjustments.static void
noTime(LocalTime startingTime, String... adjustmentsArray)
Deprecated.static ZonedDateTime
noTime(ZonedDateTime zonedDateTime, String... adjustmentsArray)
Convert a Zoned date time to a ZonedDateTime while removing the time part and optionally applying adjustments.static ZonedDateTime
noTime(Calendar startingDateTime, String... adjustmentsArray)
Convert a calendar to a ZonedDateTime instance while removing the time part and optionally applying adjustments.static ZonedDateTime
noTime(Date startingDate, String... adjustmentsArray)
Convert a date to a ZonedDateTime instance while removing the time part and optionally applying adjustments.static ICalendarFactory
reset(ICalendarFactory newFactory)
Reset calendar factory.static void
setBusinessDate(long businessDate, String... adjustmentsArray)
Set the business date from an epoch milliseconds while optionally applying adjustments.static void
setBusinessDate(String businessDate, String... adjustmentsArray)
Set the business date from a String date / time while optionally applying adjustments.static void
setBusinessDate(LocalDate businessDate, String... adjustmentsArray)
Set the business date to a LocalDate while optionally applying adjustments.static void
setBusinessDate(LocalDateTime businessDate, String... adjustmentsArray)
Sets the business date to a LocalDateTime instance while optionally applying adjustments.static void
setBusinessDate(LocalTime businessDate, String... adjustmentsArray)
Sets business date.static void
setBusinessDate(ZonedDateTime zonedDateTime, String... adjustmentsArray)
Sets the business date to a ZonedDateTime while optionally applying adjustments.static void
setBusinessDate(Calendar businessDate, String... adjustmentsArray)
Set the business date from a Calendar instance while optionally applying adjustments.static void
setBusinessDate(Date businessDate, String... adjustmentsArray)
Sets the business date to a Date while optionally applying adjustments.static void
setInDebug(boolean inDebug_parm)
Sets in debug.static ZoneId
setZoneId(ZoneId newZoneId)
Sets zone id.
-
-
-
Method Detail
-
asCalendar
public static Calendar asCalendar(ZonedDateTime zonedDateTime, String... adjustmentsArray)
Convert a ZonedDateTime to a Calendar instance while optionally applying adjustments.- Parameters:
zonedDateTime
- the zoned date timeadjustmentsArray
- the adjustments array- Returns:
- the calendar
-
asCalendar
public static Calendar asCalendar(String dateTime, String... adjustmentsArray)
Convert a String date time to a Calendar instance while optionally applying adjustments. The zone, if not part of the date string, will be applied according to the setZone method.- Parameters:
dateTime
- the date timeadjustmentsArray
- the adjustments array- Returns:
- the calendar
-
asCalendar
public static Calendar asCalendar(LocalDateTime dateTime, String... adjustmentsArray)
Convert a local date time to a Calendar instance while optionally applying adjustments. The zone will be applied according to the setZone method.- Parameters:
dateTime
- the date timeadjustmentsArray
- the adjustments array- Returns:
- the calendar
-
asCalendar
@Deprecated public static void asCalendar(LocalTime time, String... adjustmentsArray)
Deprecated.This method provides nothing since the concept is nonsense. But it is here to be a be a reminder to not try to do this.- Parameters:
time
- the timeadjustmentsArray
- the adjustments array
-
asCalendar
public static Calendar asCalendar(LocalDate date, String... adjustmentsArray)
Convert a local date to a Calendar instance while optionally applying adjustments. The zone will be applied according to the setZone method.- Parameters:
date
- the dateadjustmentsArray
- the adjustments array- Returns:
- the calendar
-
asCalendar
public static Calendar asCalendar(long epochMillisecond, String... adjustmentsArray)
Convert epoch milliseconds to a Calendar instance while optionally applying adjustments. The zone will be applied according to the setZone method.- Parameters:
epochMillisecond
- the epoch millisecondadjustmentsArray
- the adjustments array- Returns:
- the calendar
-
asCalendar
public static Calendar asCalendar(Calendar calendar, String... adjustmentsArray)
Convert a calendar to a Calendar instance while optionally applying adjustments. The zone will be applied according to the setZone method.- Parameters:
calendar
- the calendaradjustmentsArray
- the adjustments array- Returns:
- the calendar
-
asCalendar
public static Calendar asCalendar(Date date, String... adjustmentsArray)
Convert a date to a Calendar instance while optionally applying adjustments. The zone will be applied according to the setZone method.- Parameters:
date
- the dateadjustmentsArray
- the adjustments array- Returns:
- the calendar
-
asLocalDateTime
public static LocalDateTime asLocalDateTime(ZonedDateTime zonedDateTime, String... adjustmentsArray)
Convert a zoned date time to a LocalDateTime instance while optionally applying adjustments.- Parameters:
zonedDateTime
- the zoned date timeadjustmentsArray
- the adjustments array- Returns:
- the local date time
-
asLocalDateTime
public static LocalDateTime asLocalDateTime(String dateTime, String... adjustmentsArray)
Convert a String date time to a LocalDateTime instance while optionally applying adjustments. The zone, if not part of the date string, will be applied according to the setZone method.- Parameters:
dateTime
- the date timeadjustmentsArray
- the adjustments array- Returns:
- the local date time
-
asLocalDateTime
public static LocalDateTime asLocalDateTime(LocalDateTime dateTime, String... adjustmentsArray)
Convert a local date time to a LocalDateTime instance while optionally applying adjustments.- Parameters:
dateTime
- the date timeadjustmentsArray
- the adjustments array- Returns:
- the local date time
-
asLocalDateTime
public static LocalDateTime asLocalDateTime(LocalDate dateTime, String... adjustmentsArray)
Convert a local date to a LocalDate instance while optionally applying adjustments.- Parameters:
dateTime
- the date timeadjustmentsArray
- the adjustments array- Returns:
- the local date
-
asLocalDateTime
@Deprecated public static void asLocalDateTime(LocalTime time, String... adjustmentsArray)
Deprecated.This method provides nothing since the concept is nonsense. But it is here to be a be a reminder to not try to do this.- Parameters:
time
- the timeadjustmentsArray
- the adjustments array
-
asLocalDateTime
public static LocalDateTime asLocalDateTime(long epochMillisecond, String... adjustmentsArray)
Convert epoch milliseconds to a LocalDateTime instance while optionally applying adjustments. The zone will be applied according to the setZone method.- Parameters:
epochMillisecond
- the epoch millisecondadjustmentsArray
- the adjustments array- Returns:
- the local date time
-
asLocalDateTime
public static LocalDateTime asLocalDateTime(Calendar calendar, String... adjustmentsArray)
Convert a calendar to a LocalDateTime instance while optionally applying adjustments.- Parameters:
calendar
- the calendaradjustmentsArray
- the adjustments array- Returns:
- the local date time
-
asLocalDateTime
public static LocalDateTime asLocalDateTime(Date date, String... adjustmentsArray)
Convert a date to a LocalDateTime instance while optionally applying adjustments.- Parameters:
date
- the dateadjustmentsArray
- the adjustments array- Returns:
- the local date time
-
asLocalDate
public static LocalDate asLocalDate(ZonedDateTime zonedDateTime, String... adjustmentsArray)
Convert a Zoned date time to a LocalDate while optionally applying adjustments.- Parameters:
zonedDateTime
- the zoned date timeadjustmentsArray
- the adjustments array- Returns:
- the local date
-
asLocalDate
public static LocalDate asLocalDate(String dateTime, String... adjustmentsArray)
Convert a String date time to a LocalDate instance while optionally applying adjustments. The zone, if not part of the date string, will be applied according to the setZone method.- Parameters:
dateTime
- the date timeadjustmentsArray
- the adjustments array- Returns:
- the local date
-
asLocalDate
public static LocalDate asLocalDate(LocalDateTime dateTime, String... adjustmentsArray)
Convert a local date time to a LocalDate instance while optionally applying adjustments.- Parameters:
dateTime
- the date timeadjustmentsArray
- the adjustments array- Returns:
- the local date
-
asLocalDate
@Deprecated public static void asLocalDate(LocalTime time, String... adjustmentsArray)
Deprecated.This method provides nothing since the concept is nonsense. But it is here to be a be a reminder to not try to do this.- Parameters:
time
- the timeadjustmentsArray
- the adjustments array
-
asLocalDate
public static LocalDate asLocalDate(LocalDate date, String... adjustmentsArray)
Convert a local date to a LocalDate instance while optionally applying adjustments.- Parameters:
date
- the dateadjustmentsArray
- the adjustments array- Returns:
- the local date
-
asLocalDate
public static LocalDate asLocalDate(long epochMillisecond, String... adjustmentsArray)
Convert epoch milliseconds to a LocalDate instance while optionally applying adjustments. The zone will be applied according to the setZone method.- Parameters:
epochMillisecond
- the epoch millisecondadjustmentsArray
- the adjustments array- Returns:
- the local date
-
asLocalDate
public static LocalDate asLocalDate(Calendar calendar, String... adjustmentsArray)
Convert a calendar to a LocalDate instance while optionally applying adjustments.- Parameters:
calendar
- the calendaradjustmentsArray
- the adjustments array- Returns:
- the local date
-
asLocalDate
public static LocalDate asLocalDate(Date date, String... adjustmentsArray)
Convert a date to a LocalDate instance while optionally applying adjustments.- Parameters:
date
- the dateadjustmentsArray
- the adjustments array- Returns:
- the local date
-
asLocalTime
public static LocalTime asLocalTime(ZonedDateTime zonedDateTime, String... adjustmentsArray)
Convert a Zoned date time to a LocalTime while optionally applying adjustments.- Parameters:
zonedDateTime
- the zoned date timeadjustmentsArray
- the adjustments array- Returns:
- the local time
-
asLocalTime
public static LocalTime asLocalTime(String dateTime, String... adjustmentsArray)
Convert a String date time to a LocalTime instance while optionally applying adjustments. The zone, if not part of the date string, will be applied according to the setZone method.- Parameters:
dateTime
- the date timeadjustmentsArray
- the adjustments array- Returns:
- the local time
-
asLocalTime
public static LocalTime asLocalTime(LocalDateTime dateTime, String... adjustmentsArray)
Convert a local date time to a LocalTime instance while optionally applying adjustments.- Parameters:
dateTime
- the date timeadjustmentsArray
- the adjustments array- Returns:
- the local time
-
asLocalTime
public static LocalTime asLocalTime(LocalTime time, String... adjustmentsArray)
As local time local time.- Parameters:
time
- the timeadjustmentsArray
- the adjustments array- Returns:
- the local time
-
asLocalTime
public static LocalTime asLocalTime(LocalDate date, String... adjustmentsArray)
Convert a local date to a LocalTime instance while optionally applying adjustments. The time is low value.- Parameters:
date
- the dateadjustmentsArray
- the adjustments array- Returns:
- the local time
-
asLocalTime
public static LocalTime asLocalTime(long epochMillisecond, String... adjustmentsArray)
Convert epoch milliseconds to a LocalTime instance while optionally applying adjustments. The date portion will be removed. The zone will be applied according to the setZone method.- Parameters:
epochMillisecond
- the epoch millisecondadjustmentsArray
- the adjustments array- Returns:
- the local time
-
asLocalTime
public static LocalTime asLocalTime(Calendar calendar, String... adjustmentsArray)
Convert a calendar to a LocalTime instance while optionally applying adjustments.- Parameters:
calendar
- the calendaradjustmentsArray
- the adjustments array- Returns:
- the local time
-
asLocalTime
public static LocalTime asLocalTime(Date date, String... adjustmentsArray)
Convert a date to a LocalTime instance while optionally applying adjustments.- Parameters:
date
- the dateadjustmentsArray
- the adjustments array- Returns:
- the local time
-
asDate
public static Date asDate(ZonedDateTime zonedDateTime, String... adjustmentsArray)
Convert a ZonedDateTime to a Date instance while optionally applying adjustments.- Parameters:
zonedDateTime
- the zoned date timeadjustmentsArray
- the adjustments array- Returns:
- the date
-
asDate
public static Date asDate(String dateTime, String... adjustmentsArray)
Convert a String date time to a Date instance while optionally applying adjustments. The zone, if not part of the date string, will be applied according to the setZone method.- Parameters:
dateTime
- the date timeadjustmentsArray
- the adjustments array- Returns:
- the date
-
asDate
public static Date asDate(LocalDateTime dateTime, String... adjustmentsArray)
Convert a local date time to a Date instance while optionally applying adjustments.- Parameters:
dateTime
- the date timeadjustmentsArray
- the adjustments array- Returns:
- the date
-
asDate
@Deprecated public static void asDate(LocalTime time, String... adjustmentsArray)
Deprecated.This method provides nothing since the concept is nonsense. But it is here to be a be a reminder to not try to do this.- Parameters:
time
- the timeadjustmentsArray
- the adjustments array
-
asDate
public static Date asDate(LocalDate date, String... adjustmentsArray)
Convert a local date to a Date instance while optionally applying adjustments.- Parameters:
date
- the dateadjustmentsArray
- the adjustments array- Returns:
- the date
-
asDate
public static Date asDate(long epochMillisecond, String... adjustmentsArray)
Convert epoch milliseconds to a Date instance while optionally applying adjustments.- Parameters:
epochMillisecond
- the epoch millisecondadjustmentsArray
- the adjustments array- Returns:
- the date
-
asDate
public static Date asDate(Calendar calendar, String... adjustmentsArray)
Convert a calendar to a Date instance while optionally applying adjustments.- Parameters:
calendar
- the calendaradjustmentsArray
- the adjustments array- Returns:
- the date
-
asDate
public static Date asDate(Date date, String... adjustmentsArray)
Convert a date to a Date instance while optionally applying adjustments.- Parameters:
date
- the dateadjustmentsArray
- the adjustments array- Returns:
- the date
-
asDateLong
public static long asDateLong(ZonedDateTime zonedDateTime, String... adjustmentsArray)
Convert a ZonedDateTime to a epoch milliseconds while removing the time part and optionally applying adjustments.- Parameters:
zonedDateTime
- the zoned date timeadjustmentsArray
- the adjustments array- Returns:
- the long
-
asDateLong
public static long asDateLong(String dateTime, String... adjustmentsArray)
Convert a String date time to an epoch milliseconds of only the date part while optionally applying adjustments. The zone, if not part of the date string, will be applied according to the setZone method.- Parameters:
dateTime
- the date timeadjustmentsArray
- the adjustments array- Returns:
- the long
-
asDateLong
public static long asDateLong(LocalDateTime dateTime, String... adjustmentsArray)
Convert a local date time to an epoch milliseconds while removing the time part and optionally applying adjustments.- Parameters:
dateTime
- the date timeadjustmentsArray
- the adjustments array- Returns:
- the long
-
asDateLong
@Deprecated public static void asDateLong(LocalTime time, String... adjustmentsArray)
Deprecated.This method provides nothing since the concept is nonsense. But it is here to be a be a reminder to not try to do this.- Parameters:
time
- the timeadjustmentsArray
- the adjustments array
-
asDateLong
public static long asDateLong(LocalDate date, String... adjustmentsArray)
Convert a local date to an epoch milliseconds while removing the time part and optionally applying adjustments.- Parameters:
date
- the dateadjustmentsArray
- the adjustments array- Returns:
- the long
-
asDateLong
public static long asDateLong(long epochMillisecond, String... adjustmentsArray)
Convert epoch milliseconds to epoch milliseconds while removing the time part and optionally applying adjustments. The zone will be applied according to the setZone method.- Parameters:
epochMillisecond
- the epoch millisecondadjustmentsArray
- the adjustments array- Returns:
- the long
-
asDateLong
public static long asDateLong(Calendar calendar, String... adjustmentsArray)
Convert a date to an epoch milliseconds while removing the time part and optionally applying adjustments.- Parameters:
calendar
- the calendaradjustmentsArray
- the adjustments array- Returns:
- the long
-
asDateLong
public static long asDateLong(Date date, String... adjustmentsArray)
Convert a date to an epoch milliseconds while removing the time part and optionally applying adjustments. The zone will be applied according to the setZone method.- Parameters:
date
- the dateadjustmentsArray
- the adjustments array- Returns:
- the long
-
asLong
public static long asLong(ZonedDateTime zonedDateTime, String... adjustmentsArray)
Convert a Zoned date time to a epoch milliseconds while optionally applying adjustments.- Parameters:
zonedDateTime
- the zoned date timeadjustmentsArray
- the adjustments array- Returns:
- the long
-
asLong
public static long asLong(String dateTime, String... adjustmentsArray)
Convert a String date time to an epoch milliseconds while optionally applying adjustments. The zone, if not part of the date string, will be applied according to the setZone method.- Parameters:
dateTime
- the date timeadjustmentsArray
- the adjustments array- Returns:
- the long
-
asLong
public static long asLong(LocalDateTime dateTime, String... adjustmentsArray)
Convert a local date time to an epoch milliseconds while optionally applying adjustments. The zone will be applied according to the setZone method.- Parameters:
dateTime
- the date timeadjustmentsArray
- the adjustments array- Returns:
- the long
-
asLong
public static long asLong(LocalDate date, String... adjustmentsArray)
Convert a local date to a epoch milliseconds while optionally applying adjustments.- Parameters:
date
- the dateadjustmentsArray
- the adjustments array- Returns:
- the long
-
asLong
@Deprecated public static void asLong(LocalTime time, String... adjustmentsArray)
Deprecated.As long.- Parameters:
time
- the timeadjustmentsArray
- the adjustments array
-
asLong
public static long asLong(long epochMillisecond, String... adjustmentsArray)
Convert epoch milliseconds to an epoch milliseconds while optionally applying adjustments. The zone will be applied according to the setZone method.- Parameters:
epochMillisecond
- the epoch millisecondadjustmentsArray
- the adjustments array- Returns:
- the long
-
asLong
public static long asLong(Calendar calendar, String... adjustmentsArray)
Convert a calendar to an epoch milliseconds while removing the time part and optionally applying adjustments.- Parameters:
calendar
- the calendaradjustmentsArray
- the adjustments array- Returns:
- the long
-
asLong
public static long asLong(Date date, String... adjustmentsArray)
Convert a date to an epoch milliseconds while optionally applying adjustments. The zone will be applied according to the setZone method.- Parameters:
date
- the dateadjustmentsArray
- the adjustments array- Returns:
- the long
-
asFormula
public static String asFormula(Calendar calendar, String... adjustmentsArray)
Convert a calendar to a list of adjustments while optionally applying adjustments. The zone will be applied according to the setZone method.- Parameters:
calendar
- the calendaradjustmentsArray
- the adjustments array- Returns:
- the string
-
asFormula
public static String asFormula(Date date, String... adjustmentsArray)
Convert a date instance to a list of adjustments while optionally applying adjustments. The zone will be applied according to the setZone method.- Parameters:
date
- the dateadjustmentsArray
- the adjustments array- Returns:
- the string
-
asFormula
public static String asFormula(String dateTime, String... adjustmentsArray)
Convert a String date time to a list of adjustments while optionally applying adjustments. The zone, if not part of the date string, will be applied according to the setZone method.- Parameters:
dateTime
- the date timeadjustmentsArray
- the adjustments array- Returns:
- the string
-
asFormula
public static String asFormula(LocalDate date, String... adjustmentsArray)
Convert a local date to a list of adjustments while optionally applying adjustments. The zone will be applied according to the setZone method.- Parameters:
date
- the dateadjustmentsArray
- the adjustments array- Returns:
- the string
-
asFormula
@Deprecated public static void asFormula(LocalTime time, String... adjustmentsArray)
Deprecated.This method provides nothing since the concept is nonsense. But it is here to be a be a reminder to not try to do this.- Parameters:
time
- the timeadjustmentsArray
- the adjustments array
-
asFormula
public static String asFormula(long epochMillisecond, String... adjustmentsArray)
Convert epoch milliseconds to a list of adjustments while optionally applying adjustments. The zone will be applied according to the setZone method.- Parameters:
epochMillisecond
- the epoch millisecondadjustmentsArray
- the adjustments array- Returns:
- the string
-
asFormula
public static String asFormula(ZonedDateTime zonedDateTime, String... adjustmentsArray)
Convert a Zoned date time to a list of adjustments while optionally applying adjustments.- Parameters:
zonedDateTime
- the zoned date timeadjustmentsArray
- the adjustments array- Returns:
- the string
-
asFormula
public static String asFormula(LocalDateTime dateTime, String... adjustmentsArray)
Convert a local date time to a list of adjustments while optionally applying adjustments. The zone will be applied according to the setZone method.- Parameters:
dateTime
- the date timeadjustmentsArray
- the adjustments array- Returns:
- the string
-
asJSON
public static String asJSON(Calendar calendar, String... adjustmentsArray)
Convert a calendar to a JSON formatted String while optionally applying adjustments. The zone will be applied according to the setZone method.- Parameters:
calendar
- the calendaradjustmentsArray
- the adjustments array- Returns:
- the string
-
asJSON
public static String asJSON(Date date, String... adjustmentsArray)
Convert a date to a JSON formatted String while optionally applying adjustments. The zone will be applied according to the setZone method.- Parameters:
date
- the dateadjustmentsArray
- the adjustments array- Returns:
- the string
-
asJSON
public static String asJSON(long epochMillisecond, String... adjustmentsArray)
Convert epoch milliseconds to a JSON formatted String while optionally applying adjustments. The zone will be applied according to the setZone method.- Parameters:
epochMillisecond
- the epoch millisecondadjustmentsArray
- the adjustments array- Returns:
- the string
-
asJSON
public static String asJSON(String dateTime, String... adjustmentsArray)
Convert a String date time to a JSON formatted date / time while optionally applying adjustments. The zone, if not part of the date string, will be applied according to the setZone method.- Parameters:
dateTime
- the date timeadjustmentsArray
- the adjustments array- Returns:
- the string
-
asJSON
public static String asJSON(LocalDate date, String... adjustmentsArray)
Convert a local date to a JSON formatted String while optionally applying adjustments. The zone will be applied according to the setZone method.- Parameters:
date
- the dateadjustmentsArray
- the adjustments array- Returns:
- the string
-
asJSON
public static String asJSON(LocalTime time, String... adjustmentsArray)
As json string.- Parameters:
time
- the timeadjustmentsArray
- the adjustments array- Returns:
- the string
-
asJSON
public static String asJSON(ZonedDateTime zonedDateTime, String... adjustmentsArray)
Convert a Zoned date time to a JSON formatted String while optionally applying adjustments.- Parameters:
zonedDateTime
- the zoned date timeadjustmentsArray
- the adjustments array- Returns:
- the string
-
asJSON
public static String asJSON(LocalDateTime ldt, String... adjustmentsArray)
Convert a local date time to a JSON formatted String while optionally applying adjustments. The zone will be applied according to the setZone method.- Parameters:
ldt
- the ldtadjustmentsArray
- the adjustments array- Returns:
- the string
-
asZoned
public static ZonedDateTime asZoned(Calendar calendar, String... adjustmentsArray)
Convert a calendar to a ZonedDateTime instance while optionally applying adjustments. The zone will be applied according to the setZone method.- Parameters:
calendar
- the calendaradjustmentsArray
- the adjustments array- Returns:
- the zoned date time
-
asZoned
public static ZonedDateTime asZoned(Date date, String... adjustmentsArray)
Convert a date to a ZonedDateInstance instance while optionally applying adjustments. The zone will be applied according to the setZone method.- Parameters:
date
- the dateadjustmentsArray
- the adjustments array- Returns:
- the zoned date time
-
asZoned
public static ZonedDateTime asZoned(LocalDate date, String... adjustmentsArray)
Convert a local date to a ZonedDateTime instance while optionally applying adjustments. The time part will be lower bounds. The zone will be applied according to the setZone method.- Parameters:
date
- the dateadjustmentsArray
- the adjustments array- Returns:
- the zoned date time
-
asZoned
public static ZonedDateTime asZoned(ZonedDateTime dateTime, String... adjustmentsArray)
Convert a Zoned date time to a ZonedDateTime while optionally applying adjustments.- Parameters:
dateTime
- the date timeadjustmentsArray
- the adjustments array- Returns:
- the zoned date time
-
asZoned
public static ZonedDateTime asZoned(LocalDateTime dateTime, String... adjustmentsArray)
Convert a local date time to a ZonedDateTime instance while optionally applying adjustments. The zone will be applied according to the setZone method.- Parameters:
dateTime
- the date timeadjustmentsArray
- the adjustments array- Returns:
- the zoned date time
-
asZoned
public static ZonedDateTime asZoned(LocalTime time, String... adjustmentsArray)
As zoned zoned date time.- Parameters:
time
- the timeadjustmentsArray
- the adjustments array- Returns:
- the zoned date time
-
asZoned
public static ZonedDateTime asZoned(String datetime, String... adjustmentsArray)
Convert a String date time to a ZonedDateTime instance while optionally applying adjustments. The zone, if not part of the date string, will be applied according to the setZone method.- Parameters:
datetime
- the datetimeadjustmentsArray
- the adjustments array- Returns:
- the zoned date time
-
asZoned
public static ZonedDateTime asZoned(long epochMillisecond, String... adjustmentsArray)
Convert epoch milliseconds to a ZonedDateTime instance while optionally applying adjustments. The zone will be applied according to the setZone method.- Parameters:
epochMillisecond
- the epoch millisecondadjustmentsArray
- the adjustments array- Returns:
- the zoned date time
-
getInstance
public static ICalendarFactory getInstance()
Gets instance.- Returns:
- the instance
-
isInDebug
public static boolean isInDebug()
Is in debug boolean.- Returns:
- the boolean
-
noTime
public static ZonedDateTime noTime(Calendar startingDateTime, String... adjustmentsArray)
Convert a calendar to a ZonedDateTime instance while removing the time part and optionally applying adjustments. The zone will be applied according to the setZone method.- Parameters:
startingDateTime
- the starting date timeadjustmentsArray
- the adjustments array- Returns:
- the zoned date time
-
noTime
public static ZonedDateTime noTime(Date startingDate, String... adjustmentsArray)
Convert a date to a ZonedDateTime instance while removing the time part and optionally applying adjustments. The zone will be applied according to the setZone method.- Parameters:
startingDate
- the starting dateadjustmentsArray
- the adjustments array- Returns:
- the zoned date time
-
noTime
public static ZonedDateTime noTime(ZonedDateTime zonedDateTime, String... adjustmentsArray)
Convert a Zoned date time to a ZonedDateTime while removing the time part and optionally applying adjustments.- Parameters:
zonedDateTime
- the zoned date timeadjustmentsArray
- the adjustments array- Returns:
- the zoned date time
-
noTime
public static ZonedDateTime noTime(LocalDateTime startingDateTime, String... adjustmentsArray)
Convert a local date time to a ZonedDateTime instance while removing the time part and optionally applying adjustments. The zone will be applied according to the setZone method.- Parameters:
startingDateTime
- the starting date timeadjustmentsArray
- the adjustments array- Returns:
- the zoned date time
-
noTime
public static ZonedDateTime noTime(LocalDate startingDate, String... adjustmentsArray)
Convert a local date to a ZonedDateTime instance while removing the time part and optionally applying adjustments. The zone will be applied according to the setZone method.- Parameters:
startingDate
- the starting dateadjustmentsArray
- the adjustments array- Returns:
- the zoned date time
-
noTime
@Deprecated public static void noTime(LocalTime startingTime, String... adjustmentsArray)
Deprecated.This method provides nothing since the concept is nonsense. But it is here to be a be a reminder to not try to do this.- Parameters:
startingTime
- the starting timeadjustmentsArray
- the adjustments array
-
noTime
public static ZonedDateTime noTime(String startingDateTime, String... adjustmentsArray)
Convert a String date time to a ZonedDateTime instance while removing the time portion and optionally applying adjustments. The zone, if not part of the date string, will be applied according to the setZone method.- Parameters:
startingDateTime
- the starting date timeadjustmentsArray
- the adjustments array- Returns:
- the zoned date time
-
noTime
public static ZonedDateTime noTime(long epochMillisecond, String... adjustmentsArray)
Convert epoch milliseconds to a ZonedDateTime instance while removing the time part and optionally applying adjustments. The zone will be applied according to the setZone method.- Parameters:
epochMillisecond
- the epoch millisecondadjustmentsArray
- the adjustments array- Returns:
- the zoned date time
-
reset
public static ICalendarFactory reset(ICalendarFactory newFactory)
Reset calendar factory.- Parameters:
newFactory
- the new factory- Returns:
- the calendar factory
-
setBusinessDate
public static void setBusinessDate(ZonedDateTime zonedDateTime, String... adjustmentsArray)
Sets the business date to a ZonedDateTime while optionally applying adjustments.- Parameters:
zonedDateTime
- the zoned date timeadjustmentsArray
- the adjustments array
-
setBusinessDate
public static void setBusinessDate(LocalDateTime businessDate, String... adjustmentsArray)
Sets the business date to a LocalDateTime instance while optionally applying adjustments. The zone will be applied according to the setZone method.- Parameters:
businessDate
- the business dateadjustmentsArray
- the adjustments array
-
setBusinessDate
public static void setBusinessDate(LocalDate businessDate, String... adjustmentsArray)
Set the business date to a LocalDate while optionally applying adjustments. The time will be lower bounds. The zone will be applied according to the setZone method.- Parameters:
businessDate
- the business dateadjustmentsArray
- the adjustments array
-
setBusinessDate
public static void setBusinessDate(LocalTime businessDate, String... adjustmentsArray)
Sets business date.- Parameters:
businessDate
- the business dateadjustmentsArray
- the adjustments array
-
setBusinessDate
public static void setBusinessDate(Date businessDate, String... adjustmentsArray)
Sets the business date to a Date while optionally applying adjustments. The zone will be applied according to the setZone method.- Parameters:
businessDate
- the business dateadjustmentsArray
- the adjustments array
-
setBusinessDate
public static void setBusinessDate(Calendar businessDate, String... adjustmentsArray)
Set the business date from a Calendar instance while optionally applying adjustments. The zone will be applied according to the setZone method.- Parameters:
businessDate
- the business dateadjustmentsArray
- the adjustments array
-
setBusinessDate
public static void setBusinessDate(long businessDate, String... adjustmentsArray)
Set the business date from an epoch milliseconds while optionally applying adjustments. The zone will be applied according to the setZone method.- Parameters:
businessDate
- the business dateadjustmentsArray
- the adjustments array
-
setBusinessDate
public static void setBusinessDate(String businessDate, String... adjustmentsArray)
Set the business date from a String date / time while optionally applying adjustments. The zone, if not part of the date string, will be applied according to the setZone method.- Parameters:
businessDate
- the business dateadjustmentsArray
- the adjustments array
-
setInDebug
public static void setInDebug(boolean inDebug_parm)
Sets in debug.- Parameters:
inDebug_parm
- the in debug parm
-
-