Howdy, Stranger!

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

Sign In with Facebook Sign In with Google Sign In with OpenID

Categories

We have migrated to a new platform! Please note that you will need to reset your password to log in (your credentials are still in-tact though). Please contact lee@programmersheaven.com if you have questions.
Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

how to declare a date type variable in Java?

ligangligang Posts: 76Member
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

  • Feanors CurseFeanors Curse Posts: 70Member
    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]

  • chamsterchamster Posts: 662Member
    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
    chamster@home.se
    http://konrads.webbsida.com

  • ligangligang Posts: 76Member
    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
    : chamster@home.se
    : http://konrads.webbsida.com
    :
    :

  • chamsterchamster Posts: 662Member
    : 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
    chamster@home.se
    http://konrads.webbsida.com

  • ligangligang Posts: 76Member
    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
    : chamster@home.se
    : http://konrads.webbsida.com
    :
    :

  • chamsterchamster Posts: 662Member
    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
    chamster@home.se
    http://konrads.webbsida.com

Sign In or Register to comment.