-
>>> 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 !!! :)
-
try a GregorianCalendar instead
:)
-
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. :p
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.