Link to home
Start Free TrialLog in
Avatar of RedRichard
RedRichard

asked on

Dealing with 'time'.

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?
Avatar of CEHJ
CEHJ
Flag of United Kingdom of Great Britain and Northern Ireland image

long createdAt = System.getTimeMillis();

should do
ASKER CERTIFIED SOLUTION
Avatar of CEHJ
CEHJ
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of RedRichard
RedRichard

ASKER

Thanks, had a feeling there would be a quick way.
:-)