|
-
Jul 2nd, 2003, 09:51 PM
#1
Thread Starter
Lively Member
Last edited by blur; Jul 3rd, 2003 at 04:07 AM.
-
Jul 2nd, 2003, 10:00 PM
#2
Check the documentation here
The new way is to use Calendar...
Code:
Calendar.get(Calendar.MONTH)
Laugh, and the world laughs with you. Cry, and you just water down your vodka.
Take credit, not responsibility
-
Jul 2nd, 2003, 10:09 PM
#3
Thread Starter
Lively Member
but how? I've tried it actually but it doesn't recognise Calender, always give me "cannot resolve symbol".
The problem is that I don't understand what's the documentation talking about.
Mind to implement it in my code for me to see?
-
Jul 2nd, 2003, 10:16 PM
#4
Okay, I forgot that Calendar is an abstract class...
Code:
public int getMonth()
{
return (Calendar.getInstance()).get(Calendar.MONTH);
}
should do the trick.
Laugh, and the world laughs with you. Cry, and you just water down your vodka.
Take credit, not responsibility
-
Jul 2nd, 2003, 10:37 PM
#5
Thread Starter
Lively Member
Gee.. thanks. No need to import anything right? I haven't try it out yet but it seems very promising hopefully it works, i've spent 3 hours on it last night ;p
-
Jul 2nd, 2003, 10:42 PM
#6
Originally posted by blur
No need to import anything right?
Well, yes and no. Calendar is in the java.util package. If you want to import the package, its...
Code:
import java.util.*;
If not, you have to fully qualify the util package...
Code:
public int getMonth()
{
return (java.util.Calendar.getInstance()).get(java.util.Calendar.MONTH);
}
Laugh, and the world laughs with you. Cry, and you just water down your vodka.
Take credit, not responsibility
-
Jul 2nd, 2003, 10:54 PM
#7
Thread Starter
Lively Member
ok
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
|