• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

meaning?

 
Donald Wynn
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I would like to know what this line of code means
Calendar cal = Calendar.getInstance(TimeZone.getDefault());
 
Andrew Fischer
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That line of code constructs a Calendar object initialized to the current date and time in the default time zone.

Sun Documentation for Calendar
 
Donald Wynn
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What does that mean?
 
Cindy Glass
"The Hood"
Sheriff
Posts: 8521
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It is creating a variable named cal of type Calendar and then calling the constructor of the Calendar class using the "new" keyword to create an instance of Calendar that is looking at the PC that it is running on to find out what the default timezone for that PC is. If this is running on a server it would pick up the timezone for the server.
[ fixed small typo -ds ]
[ December 04, 2002: Message edited by: Dirk Schreckmann ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic