java.time.OffsetDateTime 类表示在ISO-8601日历系统中与UTC/Greenwich的偏移量的日期时间,例如as 2007-12-03T10:15:30 + 01:00.
以下是 java.time的声明.OffsetDateTime class :
public final class OffsetDateTime extends Object implements Temporal, TemporalAdjuster, Comparable<OffsetDateTime>, Serializable
以下是 java.time.OffsetDateTime class :
static OffsetDateTime MAX : 支持的最大OffsetDateTime,'+ 999999999-12-31T23:59:59.999999999 + 18:00'.
静态OffsetDateTime MIN &减去;支持的最小OffsetDateTime,' - 999999999-01-01T00:00:00-18:00'.
Sr.No. | 方法&描述 |
---|---|
1 | Temporal adjustInto(Temporal temporal) 将指定的时间对象调整为具有相同的日期和时间这个对象. |
2 | ZonedDateTime atZoneSameInstant(ZoneId zone) 将此日期时间与时区组合以创建ZonedDateTime以确保结果有相同的时刻. |
3 | ZonedDateTime atZoneSimilarLocal(ZoneId zone) 将此日期时间与时区结合使用尝试保持相同的本地日期和时间创建ZonedDateTime. |
4 | int compareTo(OffsetDateTime other) 比较此日期 - 到另一个日期时间的时间. |
5 | boolean equals(Object obj) 检查此日期时间是否等于另一个日期-time. |
6 | String format(DateTimeFormatter formatter) 使用指定的格式化程序格式化此日期时间. |
7 | static OffsetDateTime from(TemporalAccessor temporal) 从时态对象获取OffsetDateTime的实例. |
8 | int get(TemporalField field) 从中获取指定字段的值这个日期时间是一个int. |
9 | int getDayOfMonth() 获取日期字段. |
10 | DayOfWeek getDayOfWeek() 获取星期几字段,这是一个枚举DayOfWeek. |
11 | int getDayOfYear() 获取年日字段. |
12 | int getHour() 获取当日时间字段. |
13 | long getLong(TemporalField field) 从此日期时间获取指定字段的值为long. |
14 | Month getMinute() 获取分钟字段. |
15 | Month getMonth() 获取使用该年份的月份字段月枚举. |
16 | int getMonthValue() 获取1到12之间的年份字段. |
17 | int getNano() 获取纳秒级字段. |
18 | ZoneOffset getOffset() 获取区域偏移量,例如'+01:00'. |
19 | int getSecond() 获取第二分钟字段. |
20 | int getYear() 获取年份字段. |
21 | int hashCode() 此日期时间的哈希码. |
22 | boolean isAfter(OffsetDateTime other) 检查此日期时间是否在指定的日期时间之后. |
23 | boolean isBefore(OffsetDateTime other) 检查此日期时间是否在指定的日期时间之前. |
24 | boolean isEqual(OffsetDateTime other) 检查此日期时间是否等于指定的日期时间. |
25 | boolean isSupported(TemporalField field) 检查指定的字段是否为suppor特德. |
26 | boolean isSupported(TemporalUnit unit) 检查指定的单位是否受支持. |
27 | OffsetDateTime minus(long amountToSubtract, TemporalUnit unit) 返回此日期时间的副本,并减去指定的数量. |
28 | OffsetDateTime minus(TemporalAmount amountToSubtract) 返回此日期时间的副本,并减去指定的金额. |
29 | OffsetDateTime minusDays(long daysToSubtract) 返回此OffsetDateTime的副本,并减去指定的天数. |
30 | OffsetDateTime minusHours(long hoursToSubtract) 返回此OffsetDateTime的副本,并减去指定的小时数. |
31 | OffsetDateTime minusMinutes(long minutesToSubtract) 返回此OffsetDateTime的副本,并减去指定的分钟数. |
32 | OffsetDateTime minusMonths(long monthsToSubtract) 返回此OffsetDateTime的副本,并减去指定的月数. |
33 | OffsetDateTime minusNanos(long nanos) 返回此OffsetDateTime的副本,减去指定的纳秒数. |
34 | OffsetDateTime minusSeconds(long seconds) 返回此OffsetDateTime的副本,并减去指定的秒数. |
35 | OffsetDateTime minusWeeks(long weeksToSubtract) 返回此OffsetDateTime的副本,并减去指定的周数. |
36 | OffsetDateTime minusYears(long yearsToSubtract) 返回此OffsetDateTime的副本,并减去指定的年数. |
37 | static OffsetDateTime now() 从默认时区中的系统时钟获取当前日期时间. |
38 | static OffsetDateTime now(Clock clock) 从指定时钟获得当前日期时间. |
39 | static OffsetDateTime now(ZoneId zone) 从指定时区的系统时钟获取当前日期时间. |
40 | static OffsetDateTime of(int year, int month, int dayOfMonth, int hour, int minute, int second, int nanoOfSecond, ZoneOffset offset) 从年,月,日,小时,分钟,秒,纳秒和偏移量中获取OffsetDateTime的实例. |
41 | static OffsetDateTime of(LocalDate date, LocalTime time, ZoneOffset offset) 从日期,时间和偏移量中获取OffsetDateTime的实例. |
42 | static OffsetDateTime(LocalDateTime dateTime,ZoneOffset offset) 从日期时间和偏移量中获取OffsetDateTime的实例. |
43 | static OffsetDateTime ofInstant(Instant instant, ZoneId zone) 从Instant和区域ID中获取OffsetDateTime的实例. |
44 | static OffsetDateTime parse(CharSequence text) 从文本字符串中获取OffsetDateTime的实例,例如2007-12-03T10:15:30. |
45 | static OffsetDateTime parse(CharSequence text,DateTimeFormatter formatter) 使用特定的格式化程序从文本字符串中获取OffsetDateTime的实例. |
46 | OffsetDateTime plus(long amountToAdd,TemporalUnit unit) ) 返回此日期时间的副本,并添加指定的金额. |
47 | OffsetDateTime plus(TemporalAmount amountToAdd) 返回此日期时间的副本,并添加指定的金额. |
48 | OffsetDateTime plusDays(long daysToAdd) 返回此OffsetDateTime的副本,并添加指定的天数. |
49 | OffsetDateTime plusHours(long hoursToAdd) 返回此OffsetDateTime的副本,并添加指定的小时数. |
50 | OffsetDateTime plusMinutes(long minutesToAdd) 返回此OffsetDateTime的副本,并添加指定的分钟数. |
51 | OffsetDateTime plusMonths(long monthsToAdd) 返回此OffsetDateTime的副本,其中添加了指定的月数. |
52 | OffsetDateTime plusNanos(long nanos) 返回此OffsetDateTime的副本,其中添加了指定的纳秒数. |
53 | OffsetDateTime plusSeconds(long seconds) 返回此OffsetDateTime的副本指定的秒数. |
54 | OffsetDateTime plusWeeks(long weeksToAdd) 返回此OffsetDateTime的副本,其指定的数量为已添加周数. |
55 | OffsetDateTime plusYears(long yearsToAdd) 返回此OffsetDateTime的副本,其中添加了指定的年数. |
56 | <R> R query(TemporalQuery<R> query) 使用指定的查询查询该日期时间. |
57 | ValueRange range(TemporalField field) 获取指定字段的有效值范围. |
58 | static Comparator<OffsetDateTime> timeLineOrder() 获取一个比较器,它仅根据瞬间比较两个OffsetDateTime实例. |
59 | long toEpochSecond() 将此日期时间转换为1970-01-01T00:00:00Z纪元的秒数. |
60 | Instant toInstant( ) 将此日期时间转换为即时. |
61 | LocalDate toLocalDate() 获取此日期时间的LocalDate部分. |
62 | LocalDateTime toLocalDateTime() 获取此日期时间的LocalDateTime部分. |
63 | LocalTime toLocalTime() 获取此日期时间的LocalTime部分. |
64 | OffsetTime toOffsetTime() 获取OffsetTime部分日期时间. |
65 | String toString() 将此日期输出为字符串,例如2007-12-03T10:15 :30. |
66 | ZonedDateTime toZonedDateTime() 将此日期时间转换为Zoned DateTime使用偏移量作为区域ID. |
67 | OffsetDateTime truncatedTo(TemporalUnit unit) 返回此OffsetDateTime的副本与时间截断. |
68 | long(Temporal endExclusive,TemporalUnit unit) 计算到达另一个日期时间的时间量指定的单位. |
69 | OffsetDateTime with(TemporalAdjuster adjuster) 返回此日期时间的调整副本. |
70 | OffsetDate时间(TemporalField字段,long newValue) 返回此日期时间的副本,并将指定字段设置为新值. |
71 | OffsetDateTime withDayOfMonth(int dayOfMonth) 返回此OffsetDateTime的副本,其中每日更改日期. |
72 | OffsetDateTime withDayOfYear(int dayOfYear) 返回此OffsetDateTime的副本,其中每年更改日期. |
73 | OffsetDateTime withHour(int hour) 返回此OffsetDateTime的副本,并更改日期. |
74 | OffsetDateTime withMinute(int minute) 返回此副本OffsetDateTime,每小时更改一次. |
75 | OffsetDateTime withMonth(int month) 返回此OffsetDateTime的副本年度变更. |
76 | OffsetDateTime withNano(int nanoOfSecond) 返回此OffsetDateTime的副本,其中包含nano-of - 第二次改变. |
77 | OffsetDateTime withOffsetSameInstant(ZoneOffset offset) 返回此O的副本具有指定偏移量的ffsetDateTime确保结果在同一时刻. |
78 | OffsetDateTime withOffsetSameLocal(ZoneOffset offset) 返回副本具有指定偏移量的此OffsetDateTime确保结果具有相同的本地日期时间. |
79 | OffsetDateTime withSecond(int second) 返回此OffsetDateTime的副本,并在第二分钟更改. |
80 | OffsetDateTime withYear(int year) 返回a这个OffsetDateTime的副本,年份已更改. |
此类继承以下类中的方法 :
Java.lang.对象