- java.time 包类
- java.time - 主页
- java.time - 时钟
- java.time - 时段
- java.time - 瞬时时间点
- java.time - 日期
- java.time - 日期时间
- java.time - 时间
- java.time - 月日
- java.time - 带时差的日期时间
- java.time - 带时差的时间
- java.time - 间隔
- java.time - 年
- java.time - 年月
- java.time - 带时区的日期时间
- java.time - 时区 ID
- java.time - 时区偏移量
- java.time 包枚举
- java.time - 月份
- java.time 资源常用链接
- java.time - 讨论
java.time.LocalDateTime.getDayOfYear() 方法示例
说明
java.time.LocalDateTime.getDayOfYear() 方法获取年中第几天。
声明
以下是 java.time.LocalDateTime.getDayOfYear() 方法的声明。
public int getDayOfYear()
返回值
年中第几天,从 1 到 365,或者闰年的 366。
示例
以下示例演示了如何使用 java.time.LocalDateTime.getDayOfYear() 方法。
package com.tutorialspoint;
import java.time.LocalDateTime;
public class LocalDateTimeDemo {
public static void main(String[] args) {
LocalDateTime date = LocalDateTime.parse("2017-02-03T12:30:30");
System.out.println(date.getDayOfYear());
}
}
让我们编译并运行以上程序,这将产生以下结果 −
34
广告