Solved

Time?

Posted on 2004-08-01
8
153 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
  • 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Tomcat: Unable to run tomcat service. 2 28
Which non-HTML GUI front end to use with Java? 3 50
Eclipse Java import and method not resolved 4 73
junit example issue 2 22
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…
Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
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…
The viewer will learn how to implement Singleton Design Pattern in Java.

679 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