Solved

Time?

Posted on 2004-08-01
8
150 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
 
LVL 3

Author Comment

by:Unimatrix_001
ID: 11689214
...I feel so stupid... how I didn't see that before!?!? :S ...Thanks CEHJ :-)
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:

863 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now