Convert Min to string !!
Posted in 1999
Topics: General Discussion
Hi, I have a long variable : x= 600 000 minute !! ( Is computed from 1.1.1900 ) How kann i easy translate in string: "1999-06-13 25:52" thank you.
fm wrote: > > Hi, > > I have a long variable : x= 600 000 minute !! > ( Is computed from 1.1.1900 ) > > How kann i easy translate in string: "1999-06-13 25:52" in pseudocode where x is the input minutes: MonthDays[13] = {0,31,59,90,120,151,181,212,243,273,304,334,365}; YearMins = (365.25 * 24.0 * 60.0) = 525960 years = x / YearMins leaps = years / 4 year = 1900 + years yearminutes = (x % YearMins) yeardays = yearmins / 1440 # Adjust MonthDays for leapyear - modulus works because 1900 is base yr if ((years % 4) == 0) for (idx=2; ix < 13; idx++) MonthDays[IDX] += 1; for (idx=0; idx < 13; idx++) if (MonthDays[ids] > yeardays) break; month = idx; day = yeardays - MonthDays[idx-1]; hours = (yearmins % 1440) / 60 mins = (yearmins % 1440) % 60 print year,"-",month,"-",day," ",hours,":",mins; Art S. Kagel Caviat: Not tested but it should be correct.