[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Dealing with 'time'.

Posted on 2003-11-27
4
Medium Priority
?
225 Views
Last Modified: 2010-03-31
I'm working on an application where I want to give an object on creation, a time attribute so that i can later compare it's time of creation with the current time.

What's a good way to do this?

The Calendar class? though, getTimeInMillis() and setTimeInMillis()methods are protected so do I need a class of my own to extend Calendar before I can use these methods?
0
Comment
Question by:RedRichard
  • 3
4 Comments
 
LVL 86

Expert Comment

by:CEHJ
ID: 9833324
long createdAt = System.getTimeMillis();

should do
0
 
LVL 86

Accepted Solution

by:
CEHJ earned 200 total points
ID: 9833327
Sorry, that's

long createdAt = System.currentTimeMillis() ;
0
 

Author Comment

by:RedRichard
ID: 9833355
Thanks, had a feeling there would be a quick way.
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 9833363
:-)
0

Featured Post

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!

Question has a verified solution.

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

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 functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
The viewer will learn how to implement Singleton Design Pattern in Java.
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
Suggested Courses
Course of the Month18 days, 2 hours left to enroll

830 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