Java Calendar FEBRUARY
Syntax
Calendar.FEBRUARY has the following syntax.
public static final int FEBRUARY
Example
In the following code shows how to use Calendar.FEBRUARY field.
//w w w .j a v a 2 s .co m
import java.util.Calendar;
public class Main {
public static void main(String[] args) {
Calendar now = Calendar.getInstance();
System.out.println(now.getTime());
int month = now.get(Calendar.MONTH);
if(month == Calendar.JANUARY){
System.out.println("JANUARY");
}
if(month == Calendar.FEBRUARY){
System.out.println("FEBRUARY");
}
if(month == Calendar.MARCH){
System.out.println("MARCH");
}
if(month == Calendar.APRIL){
System.out.println("APRIL");
}
if(month == Calendar.MAY){
System.out.println("MAY");
}
if(month == Calendar.JUNE){
System.out.println("JUNE");
}
if(month == Calendar.JULY){
System.out.println("JULY");
}
if(month == Calendar.AUGUST){
System.out.println("AUGUST");
}
if(month == Calendar.SEPTEMBER){
System.out.println("SEPTEMBER");
}
if(month == Calendar.OCTOBER){
System.out.println("OCTOBER");
}
if(month == Calendar.NOVEMBER){
System.out.println("NOVEMBER");
}
if(month == Calendar.DECEMBER){
System.out.println("DECEMBER");
}
}
}
The code above generates the following result.
Home »
Java Tutorial »
java.util »
Java Tutorial »
java.util »