how to declare a date type variable in Java?

I declare some variable
private Date birthDate;

But compiled error :
Java5 Class Date not found .

how to declare a date type variable in Java?

Comments

  • You have to write [italic]import java.util.*[/italic] at the top of your source file.

    : I declare some variable
    : private Date birthDate;
    :
    : But compiled error :
    : Java5 Class Date not found .
    :
    : how to declare a date type variable in Java?
    :
    :


    [size=1][Blue]For our true nature is sin
    [B]Cradle of Filth[/b]

    Wer Rtsel mag, sollte mein Forum besuchen:
    http://www.boardy.de/forumdisplay.php3?forumid=1046[Black][size=2]

  • I wouldn't recommend using Date. It has other purpose than what you most likely would expect. The most of it is deprecated, as well.

    Look at Calendar and Time as well. Also, depending on what you want to do, it might be a good idea to write your own Date-class. That's what i did most of the times (well, once, and then just adjusted it a number of times). It's easier than you might think and also, you get to know the class very well as it will be adapted to your specific needs.

    Do you need help with the code?


    Kind Regards
    Konrad
    ----------------------------
    (+46/0) 708-70 73 92
    [email protected]
    http://konrads.webbsida.com

  • Sure , Konrad , I sincercly want to learn from you .
    As my next project is Java project , I don't know it's later for me to catch up

    : I wouldn't recommend using Date. It has other purpose than what you most likely would expect. The most of it is deprecated, as well.
    :
    : Look at Calendar and Time as well. Also, depending on what you want to do, it might be a good idea to write your own Date-class. That's what i did most of the times (well, once, and then just adjusted it a number of times). It's easier than you might think and also, you get to know the class very well as it will be adapted to your specific needs.
    :
    : Do you need help with the code?
    :
    :
    : Kind Regards
    : Konrad
    : ----------------------------
    : (+46/0) 708-70 73 92
    : [email protected]
    : http://konrads.webbsida.com
    :
    :

  • : As my next project is Java project , I don't know it's later for me to catch up

    I don't quite understand what you mean here...


    Kind Regards
    Konrad
    ----------------------------
    (+46/0) 708-70 73 92
    [email protected]
    http://konrads.webbsida.com

  • I am asking whether it's possible to have the basical idea of Java in around 1 month time .

    : : As my next project is Java project , I don't know it's later for me to catch up
    :
    : I don't quite understand what you mean here...
    :
    :
    : Kind Regards
    : Konrad
    : ----------------------------
    : (+46/0) 708-70 73 92
    : [email protected]
    : http://konrads.webbsida.com
    :
    :

  • Yes.

    It depends on what how you define "basic" but, still, yes. F.i. the Data class written by oneself should take about a day or two to understand, comprehend, write and test (YMMV).


    Kind Regards
    Konrad
    ----------------------------
    (+46/0) 708-70 73 92
    [email protected]
    http://konrads.webbsida.com

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories