Results 1 to 3 of 3

Thread: >>> Getting A DATE <<<

  1. #1

    Thread Starter
    Addicted Member Ramandeep's Avatar
    Join Date
    Feb 2000
    Posts
    158

    >>> Getting A DATE <<<

    Hi can any one tell me how I can get today's date (i.e. the current system date) in Java.

    Another thing how can I store the date in a object of type Date but with the format dd/mm/yy and NOT yy/mm/dd.

    I also get depreciation errors from this Date class on most of it's methods, why is this?

    !!! THANKS IN ADVANCE !!!

  2. #2
    The Devil crptcblade's Avatar
    Join Date
    Aug 2000
    Location
    Quetzalshacatenango
    Posts
    9,091
    try a GregorianCalendar instead

    Laugh, and the world laughs with you. Cry, and you just water down your vodka.


    Take credit, not responsibility

  3. #3
    Dazed Member
    Join Date
    Oct 1999
    Location
    Ridgefield Park, NJ
    Posts
    3,418
    The java.util.Date class is nothing more
    than a wrapper around a long value that
    returns the number of milliseconds from the
    epoch (midnight GMT, Janurary 1st, 1970)

    You said somthing about finding most
    of the methods deprecated.
    This is because the Calendar class is now
    the perfered way to work with dates
    according to Sun.
    Code:
     
     import java.util.Date;
    
      Date d = new Date(); // If the data constructor is called with no arguements then the date is initialized to the current time and date.
    Your best bet is to go with the java.util.Calendar and java.text.DateFormat classes.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width