get age from day, month, year,
BlitzMax Forums/BlitzMax Programming/get age from day, month, year,
| ||
How would I calculate age in minutes from minute,day,year E.g. How would you calculate age of a person in minutes if: person was born minute 1, day 2,year 2002 and now it is: minute 4,day 200,year 2004 |
| ||
Here's one that I did counting days -- could probably be adapted to also include hours/minutes. http://www.blitzmax.com/codearcs/codearcs.php?code=2088 |
| ||
A program like Microsoft Excel first converts everything to a single number, usually offset from a known starting date in the 70's or something, and then you convert back to a date. |
| ||
This Wiki article on Julian days has info on representing any given date in the number of days since January 1, 4713BC. From there, knowing a person's birth date and today's date you can easily get the number of days passed, and hence the number of minutes. |
| ||
Something like this, I suppose :SuperStrict Framework BaH.DateTime Import BRL.StandardIO ' a start time Local startTime:TTime = TTime.Create(TDate.Create(2002, Jan, 2), TDMinutes(1)) ' an end time Local endtime:TTime = TTime.Create(TDate.Create(2004, Jan, 1), TDMinutes(4)).addDays(199) ' the period of time between them Local period:TTimePeriod = TTimePeriod.Create(startTime, endTime) ' the period duration Local duration:TTimeDuration = period.length() Print (duration.totalSeconds() / 60) + " minutes" The answer appears to be 1,336,323 minutes (rounded) I realise it's not as exciting as working it out yourself from tables... but there's only so much time in a day :-p |
| ||
thanks got it now |