Solved

Time?

Posted on 2004-08-01
8
155 Views
Last Modified: 2010-03-31
Hello.

I'm wanting to store the following information about the current LOCAL time:

Year, Month, Day, Hour, Minute, Second, Millisecond.

Although I'm not quite sure about how to store it. I don't think there's a type that can store that including the seconds is there? How do I get the GMT time for this also?
0
Comment
Question by:Unimatrix_001
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
  • 2
8 Comments
 
LVL 86

Accepted Solution

by:
CEHJ earned 500 total points
ID: 11689184
Set a Calendar. Actually it'll already be holding those values when you create it
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 11689195
Calendar cal = Calendar.getInstance(TimeZone.getTimeZone("GMT"));
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 11689196
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 3

Author Comment

by:Unimatrix_001
ID: 11689214
...I feel so stupid... how I didn't see that before!?!? :S ...Thanks CEHJ :-)
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 11689216
:-)
0
 
LVL 92

Expert Comment

by:objects
ID: 11689775
You don't actually need a Calendar, the Date class can be used instead

Date today = new Date();
0
 
LVL 3

Author Comment

by:Unimatrix_001
ID: 11704535
Is there a problem using the Calender class though?...
0
 
LVL 92

Expert Comment

by:objects
ID: 11710799
No its just extra overhead, if you don't actually need then a Date would suffice.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

An old method to applying the Singleton pattern in your Java code is to check if a static instance, defined in the same class that needs to be instantiated once and only once, is null and then create a new instance; otherwise, the pre-existing insta…
Java contains several comparison operators (e.g., <, <=, >, >=, ==, !=) that allow you to compare primitive values. However, these operators cannot be used to compare the contents of objects. Interface Comparable is used to allow objects of a cl…
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
Suggested Courses

632 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question