|
-
Jan 12th, 2001, 11:16 PM
#1
Thread Starter
Addicted Member
Can someone please tell me how to get the current month, just the month, from the OS ?
Thanks in advance!!!
-
Jan 13th, 2001, 07:16 PM
#2
java.util.Calendar
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
-
Jan 15th, 2001, 09:51 PM
#3
Thread Starter
Addicted Member
Thaks a lot that works great!!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|