Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 161
  • Last Modified:

Time?

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
Unimatrix_001
Asked:
Unimatrix_001
  • 4
  • 2
  • 2
1 Solution
 
CEHJCommented:
Set a Calendar. Actually it'll already be holding those values when you create it
0
 
CEHJCommented:
Calendar cal = Calendar.getInstance(TimeZone.getTimeZone("GMT"));
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
Unimatrix_001Author Commented:
...I feel so stupid... how I didn't see that before!?!? :S ...Thanks CEHJ :-)
0
 
CEHJCommented:
:-)
0
 
objectsCommented:
You don't actually need a Calendar, the Date class can be used instead

Date today = new Date();
0
 
Unimatrix_001Author Commented:
Is there a problem using the Calender class though?...
0
 
objectsCommented:
No its just extra overhead, if you don't actually need then a Date would suffice.
0

Featured Post

Receive 1:1 tech help

Solve your biggest tech problems alongside global tech experts with 1:1 help.

  • 4
  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now