Can someone please tell me how to get the current month, just the month, from the OS ?
Thanks in advance!!!
Printable View
Can someone please tell me how to get the current month, just the month, from the OS ?
Thanks in advance!!!
Since this was returning 0, I believe this returns the Month as an int between 0-11.
import java.util.*;
public class Month{
public static void main(String [] args){
Calendar c = Calendar.getInstance();
System.out.println(c.get(Calendar.MONTH));
}
}
I tried
c.set(Calendar.MONTH, 35);
before the println to confirm that the range is between 0 and 11. It looks like there are some funky things that you can do with this.
Depending on your version, you might use
java.util.Date
Thaks a lot that works great!!