- java.time 包类
- java.time - 首页
- java.time - 时钟
- java.time - 持续时间
- java.time - Instant
- java.time - LocalDate
- java.time - LocalDateTime
- java.time - LocalTime
- java.time - MonthDay
- java.time - OffsetDateTime
- java.time - OffsetTime
- java.time - 周期
- java.time - 年
- java.time - YearMonth
- java.time - ZonedDateTime
- java.time - ZoneId
- java.time - ZoneOffset
- java.time 包枚举
- java.time - 月份
- java.time 有用资源
- java.time - 讨论
java.time.ZonedDateTime.getMonth() 方法示例
说明
java.time.ZonedDateTime.getMonth() 方法使用 Month 枚举获取月份字段。
声明
以下是 java.time.ZonedDateTime.getMonth() 方法的声明。
public Month getMonth()
返回值
月份,非 null。
示例
以下示例展示了 java.time.ZonedDateTime.getMonth() 方法的用法。
package com.tutorialspoint;
import java.time.ZonedDateTime;
public class ZonedDateTimeDemo {
public static void main(String[] args) {
ZonedDateTime date = ZonedDateTime.parse("2017-03-28T12:25:38.492+05:30[Asia/Calcutta]");
System.out.println(date.getMonth());
}
}
让我们编译并运行上述程序,这将产生以下结果 −
MARCH
广告