Meaningless Drivel is fun!
The moose likes Beginning Java and the fly likes Calendar math Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Calendar math" Watch "Calendar math" New topic

Calendar math

Jason Kwok
Ranch Hand

Joined: Mar 31, 2005
Posts: 126

I was wondering if it's possible to subtract one date from another, to determine how many days have passed?

For example:
- Say I have an record of a user account created on February 22, 2006.
- Today is March 14, 2006.

How can I determine how many days old the account is?
Ulf Dittmer

Joined: Mar 22, 2005
Posts: 42955
Here are a couple of threads that discuss the topic.
It is sorta covered in the JavaRanch Style Guide.
subject: Calendar math