• 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

Featured Post

Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

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