Click to See Complete Forum and Search --> : How to get the current month from the OS?
nievesj
Jan 12th, 2001, 10:16 PM
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
nievesj
Jan 15th, 2001, 08:51 PM
Thaks a lot that works great!!
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.