Best to repeat the subject as first line..
'How do you create a Date object
that represents the time?'. But..
> Could you please help me with this question?
..that is rather redundant for a help group!
> Please, your assistance is much appreciated!
OK, OK, stop begging! Try..
java.util.Date theTimeIsNo_TheSmiths =
new Date( System.currentTimeMillis() );
HTH

Signature
Andrew Thompson
http://www.PhySci.org/ Open-source software suite
http://www.PhySci.org/codes/ Web & IT Help
http://www.1point1C.org/ Science & Technology
Andrew Thompson - 29 Mar 2004 22:12 GMT
> java.util.Date theTimeIsNo_TheSmiths =
correction..
java.util.Date howSoonIsNow_TheSmiths =
Where was my head at? ;-)
Roedy Green - 30 Mar 2004 04:17 GMT
>correction..
>java.util.Date howSoonIsNow_TheSmiths =
I think you meant to say:
// automatically initialised to now.
java.util.Date howSoonIsNow_TheSmiths = new Date();
--
Canadian Mind Products, Roedy Green.
Coaching, problem solving, economical contract programming.
See http://mindprod.com/jgloss/jgloss.html for The Java Glossary.
Andrew Thompson - 30 Mar 2004 11:33 GMT
>>correction..
>>java.util.Date howSoonIsNow_TheSmiths =
>
> I think you meant to say:
> // automatically initialised to now.
> java.util.Date howSoonIsNow_TheSmiths = new Date();
Well wouldn't you know..
(shakes head) These new _fangled_ no args
constructors ..next thing you know they'll
have 'heavier than air' flying machines!
Jon A. Cruz - 30 Mar 2004 05:38 GMT
> OK, OK, stop begging! Try..
>
> java.util.Date theTimeIsNo_TheSmiths =
> new Date( System.currentTimeMillis() );
java.util.Date theTimeIs = new java.util.Date();
That extra call is not needed. Check the JavaDoc for the no-args
constructor.
Bryce (Work) - 30 Mar 2004 15:35 GMT
>Best to repeat the subject as first line..
>'How do you create a Date object
[quoted text clipped - 10 lines]
>java.util.Date theTimeIsNo_TheSmiths =
> new Date( System.currentTimeMillis() );
or the non-deprecated way:
Calendar calendar = new GregorianCalendar();
calendar.getTime();
--
now with more cowbell
Andrew Thompson - 30 Mar 2004 17:20 GMT
> On Mon, 29 Mar 2004 21:08:52 GMT, Andrew Thompson
...
>>java.util.Date theTimeIsNo_TheSmiths =
>> new Date( System.currentTimeMillis() );
>
> or the non-deprecated way:
I missed it, which bit of this says 'deprecated'?
<http://java.sun.com/j2se/1.4.2/docs/api/java/util/Date.html#Date(long)>
Or, was it perhaps here, you meant?
<http://java.sun.com/j2se/1.4.2/docs/api/java/lang/System.html#currentTimeMillis()>

Signature
Andrew Thompson
http://www.PhySci.org/ Open-source software suite
http://www.PhySci.org/codes/ Web & IT Help
http://www.1point1C.org/ Science & Technology
Bryce (Work) - 30 Mar 2004 18:44 GMT
>> On Mon, 29 Mar 2004 21:08:52 GMT, Andrew Thompson
>...
[quoted text clipped - 5 lines]
>I missed it, which bit of this says 'deprecated'?
><http://java.sun.com/j2se/1.4.2/docs/api/java/util/Date.html#Date(long)>
My bad... I was thinking:
date = new Date(int year, ...) which is deprecatd.
new Date (long date) isn't.
>Or, was it perhaps here, you meant?
><http://java.sun.com/j2se/1.4.2/docs/api/java/lang/System.html#currentTimeMillis()>
--
now with more cowbell
Alex Hunsley - 31 Mar 2004 10:21 GMT
> Best to repeat the subject as first line..
> 'How do you create a Date object
[quoted text clipped - 12 lines]
>
> HTH
Hmm.. how _soon_ is now? Surely the answer
would be:
long now = System.currentTimeMillis();
java.util.Date theTimeIsNo_TheSmiths =
new Date( now - now );
however, 'soonness' isn't a date, and if you ran the above code, the
answer to "how soon is now" would be '1970'. Maybe that's the answer!
alex
>Could you please help me with this question?
See various Date constructors.
See http://mindprod.com/jgloss/calendar.html for an introduction to
the mysteries of date and time.
--
Canadian Mind Products, Roedy Green.
Coaching, problem solving, economical contract programming.
See http://mindprod.com/jgloss/jgloss.html for The Java Glossary.