The Artima Developer Community
Sponsored Link

Java Answers Forum
Date wanted.

5 replies on 1 page. Most recent reply: May 27, 2004 6:52 AM by Charles Bell

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 5 replies on 1 page
Vincent O'Sullivan

Posts: 724
Nickname: vincent
Registered: Nov, 2002

Date wanted. Posted: May 20, 2004 1:16 AM
Reply to this message Reply
Advertisement
// Deprecated.
Date d1 = new Date(104, 05, 19, 21, 25);
 
// New improved.
Date d2 = new GregorianCalendar(2004, 05, 19, 21, 25).getTime();
Could someone let me know (briefly) what I've gained by using the second method of creating a given date.time?

Vince.


Adam Duffy

Posts: 168
Nickname: adamduffy
Registered: Feb, 2003

Re: Date wanted. Posted: May 21, 2004 4:40 AM
Reply to this message Reply
> Could someone let me know (briefly)
> what I've gained by using the second method of creating a
> given date.time?

A headache?

Sorry. Seriously though, it's an interesting question. This link seems to provide the answer about the whole Date, GregorianCalendar issue.

http://java.sun.com/developer/qow/archive/172/index.jsp

Adam

Steven E. Newton

Posts: 137
Nickname: cm
Registered: Apr, 2003

Re: Date wanted. Posted: May 22, 2004 7:47 PM
Reply to this message Reply
Will Daylight Saving Time be in effect at the timezone for your locale on June 19, 2004 at 21:25 hours? GregorianCalendar would know, Date doesn't. Come to think of it, when you say it's 21:25 on June 19, 2004, where in the world are you?

Vincent O'Sullivan

Posts: 724
Nickname: vincent
Registered: Nov, 2002

Re: Date wanted. Posted: May 24, 2004 2:21 AM
Reply to this message Reply
> ...where in the world are you?

Ah, that could be the clincher. I'm messing about with airline timetables. Looks like I can get rid of some of the 'offsets' I've been using to make adjustments.

Thanks (for both replies),
Vince.

Adam Duffy

Posts: 168
Nickname: adamduffy
Registered: Feb, 2003

Re: Date wanted. Posted: May 24, 2004 5:46 AM
Reply to this message Reply
> I'm messing about with airline timetables.

So you're the one responsible for those ridiculous 3 o'clock in the morning departures.....! :)

Adam

Charles Bell

Posts: 519
Nickname: charles
Registered: Feb, 2002

Re: Date wanted. Posted: May 27, 2004 6:52 AM
Reply to this message Reply
The Date class is intended to reflect coordinated
universal time (UTC). See:

http://java.sun.com/j2se/1.4.2/docs/api/java/util/Date.html

Look at the Java Language Specification at:
http://java.sun.com/docs/books/jls/first_edition/html/javautil.doc3.html#7433

"The class Date provides a system-independent
abstraction of dates and times, to a millisecond
precision."

Flat View: This topic has 5 replies on 1 page
Topic: EMMA: a fast and free code coverage tool Previous Topic   Next Topic Topic: JTree

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use