• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 226
  • Last Modified:

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?
0
RedRichard
Asked:
RedRichard
  • 3
1 Solution
 
CEHJCommented:
long createdAt = System.getTimeMillis();

should do
0
 
CEHJCommented:
Sorry, that's

long createdAt = System.currentTimeMillis() ;
0
 
RedRichardAuthor Commented:
Thanks, had a feeling there would be a quick way.
0
 
CEHJCommented:
:-)
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Introducing Cloud Class® training courses

Tech changes fast. You can learn faster. That’s why we’re bringing professional training courses to Experts Exchange. With a subscription, you can access all the Cloud Class® courses to expand your education, prep for certifications, and get top-notch instructions.

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