public class ZonedDateTimeBuilder extends Object
Calendar.Builder
replacement that
builds Java 8 ZonedDateTime
instances.Constructor and Description |
---|
ZonedDateTimeBuilder() |
Modifier and Type | Method and Description |
---|---|
java.time.ZonedDateTime |
build()
Build the
ZonedDateTime instance. |
protected int |
getBestYear()
If some fields have not been set,
intelligently set them so that we generate a observed
datestamp that is less than or slightly greater than
System.currentTimeMillis() (due to clock skew). |
static int |
getBestYearForMonth(Integer month) |
protected java.time.ZoneId |
getBestZoneId()
Return the specified ZoneId or
ZoneId.systemDefault()
if none has been specified. |
Integer |
getDayOfMonth() |
Integer |
getHourOfDay() |
Integer |
getMinute() |
Integer |
getMonth() |
Integer |
getNanosecond() |
Integer |
getSecond() |
Integer |
getYear() |
java.time.ZoneId |
getZoneId() |
static java.time.ZoneId |
parseZoneId(String value)
Convert a time zone String into a ZoneId.
|
void |
setDayOfMonth(Integer dayOfMonth) |
void |
setHourOfDay(Integer hourOfDay) |
void |
setMinute(Integer minute) |
void |
setMonth(Integer month) |
void |
setNanosecond(Integer nanosecond) |
void |
setSecond(Integer second) |
void |
setYear(Integer year) |
void |
setZoneId(java.time.ZoneId timeZone) |
public static java.time.ZoneId parseZoneId(String value)
timezone
- public Integer getYear()
public void setYear(Integer year)
public Integer getMonth()
public void setMonth(Integer month)
public Integer getDayOfMonth()
public void setDayOfMonth(Integer dayOfMonth)
public Integer getHourOfDay()
public void setHourOfDay(Integer hourOfDay)
public Integer getMinute()
public void setMinute(Integer minute)
public Integer getSecond()
public void setSecond(Integer second)
public Integer getNanosecond()
public void setNanosecond(Integer nanosecond)
public java.time.ZoneId getZoneId()
public void setZoneId(java.time.ZoneId timeZone)
public java.time.ZonedDateTime build()
ZonedDateTime
instance. The following fields
are required to generate a datestamp:
If missing:
ZoneId.systemDefault()
)protected int getBestYear()
If some fields have not been set,
intelligently set them so that we generate a observed
datestamp that is less than or slightly greater than
System.currentTimeMillis()
(due to clock skew).
For instance, around midnight on Dec 31, 2017, we do not
want to generate datestamps of Dec 31, 2018 at the instant
that LocalDateTime.now()
starts returning a
January 1, 2018 datestamp.
public static int getBestYearForMonth(Integer month)
protected java.time.ZoneId getBestZoneId()
ZoneId.systemDefault()
if none has been specified.Copyright © 2019. All rights reserved.