Java Calendar DAY_OF_YEAR

Syntax

Calendar.DAY_OF_YEAR has the following syntax.

public static final int DAY_OF_YEAR

Example

In the following code shows how to use Calendar.DAY_OF_YEAR field.


//from  w  ww  .  j av  a  2  s. c om
import java.util.Calendar;

public class Main {
  public static void main(String[] args) {
    Calendar now = Calendar.getInstance();
    System.out.println(now.getTime());
    System.out.println(now.get(Calendar.DAY_OF_YEAR));
  }
}

The code above generates the following result.