get age from day, month, year,

BlitzMax Forums/BlitzMax Programming/get age from day, month, year,

slenkar(Posted 2009) [#1]
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


xlsior(Posted 2009) [#2]
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


ImaginaryHuman(Posted 2009) [#3]
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.


Fry Crayola(Posted 2009) [#4]
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.


Brucey(Posted 2009) [#5]
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


slenkar(Posted 2009) [#6]
thanks got it now