Solved

Dealing with 'time'.

Posted on 2003-11-27
4
220 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 50 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

Active Directory Webinar

We all know we need to protect and secure our privileges, but where to start? Join Experts Exchange and ManageEngine on Tuesday, April 11, 2017 10:00 AM PDT to learn how to track and secure privileged users in Active Directory.

Question has a verified solution.

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

Suggested Solutions

For customizing the look of your lightweight component and making it look opaque like it was made of plastic.  This tip assumes your component to be of rectangular shape and completely opaque.   (CODE)
For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
Viewers learn about the “while” loop and how to utilize it correctly in Java. Additionally, viewers begin exploring how to include conditional statements within a while loop and avoid an endless loop. Define While Loop: Basic Example: Explanatio…
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:

821 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