Solved

Dealing with 'time'.

Posted on 2003-11-27
4
216 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
Comment Utility
long createdAt = System.getTimeMillis();

should do
0
 
LVL 86

Accepted Solution

by:
CEHJ earned 50 total points
Comment Utility
Sorry, that's

long createdAt = System.currentTimeMillis() ;
0
 

Author Comment

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

Expert Comment

by:CEHJ
Comment Utility
:-)
0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

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…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.

763 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

6 Experts available now in Live!

Get 1:1 Help Now