Formula to calculate days lived? - Printable Version -Shoutbox (https://shoutbox.menthix.net) +-- Forum: MsgHelp Archive (/forumdisplay.php?fid=58) +--- Forum: Skype & Technology (/forumdisplay.php?fid=9) +---- Forum: Tech Talk (/forumdisplay.php?fid=17) +----- Thread: Formula to calculate days lived? (/showthread.php?tid=68301) Formula to calculate days lived? by albert on 11-11-2006 at 09:14 PM
I'm coding this program in Java and I absolutely need a formula to be able to calculte the numbers of days lived. RE: Formula to calculate days lived? by foaly on 11-11-2006 at 10:24 PM
couldn't you just use something like: RE: Formula to calculate days lived? by qgroessl on 11-11-2006 at 10:25 PM No... cause you'd need to add in leap years and such. RE: Formula to calculate days lived? by CookieRevised on 11-12-2006 at 12:37 AM
quote:I searched the net and found tons search with "Java Datediff" http://forum.java.sun.com/thread.jspa?threadID=48...&messageID=2292012 http://forum.java.sun.com/thread.jspa?forumID=31&threadID=395202 http://www.java2s.com/Code/Java/Development-Class...etweentwodates.htm http://jalbum.net/api/se/datadosen/util/Dates.html http://www.rupertjones.com/dateutil/docs/api/com/...util/DateDiff.html etc quote:I dunno exactly for Java, but in any other language I know Date objects are in milliseconds or at least in seconds or another form which you can substract from each other. You do not need to take in account leap years, lead days and leap seconds. This is automatically done as the calenders of the objects use Gregorian calenders. But as said, I dunno if this is also the case in Java (but I would be surprised if it wasn't)... RE: Formula to calculate days lived? by RaceProUK on 11-12-2006 at 03:44 PM
quote:The Java Date object (and anything to do with dates) uses the Gregorian calendar, and will correctly deal with leap years. RE: Formula to calculate days lived? by fluffy_lobster on 11-12-2006 at 08:18 PM this is why dates need to go metric... RE: Formula to calculate days lived? by RaceProUK on 11-12-2006 at 10:46 PM
quote:They'll never go metric, simply because it's not possible to define a metric system for dates that everyone understands. Look at Swatch's failed .beat system for instance. RE: RE: Formula to calculate days lived? by rav0 on 11-13-2006 at 06:24 AM
quote:Yep, well, we need a decimal calendar (metric means based on the metre). Problem is, days and years are both determined by Earth's movement. You can't make up an arbitary unit like the metre, a year has 365 days (and a bit), that's just the way it is. RE: Formula to calculate days lived? by Jarrod on 11-14-2006 at 10:58 AM just use the counter psm script or the holiday counter have a look at how they did it |