There is no function I know of to do this directly but you
could easily write one yourself along the lines of:-
Function TimeString(Start_Date, End_Date)
Private No_of_years, No_of_months, No_of_days, Total_Days
No_of_months = 0
Total_Days = End_Date - Start_Date
No_of_years = INT (Total_Days / 365)
No_of_days = MOD (Total_Days, 365)
** Split No_of_days into Months and Days - use Month()
** function to determine month no of start_date and work
** through the calendar year reducing no_of_days by that
** number which is in the month.
Start_Month_No = MONTH(Start_Date)
DO WHILE No_of_days > GETDAYS(Start_Month_No)
Days_till_next_month = GETDAYS(Start_Month_No)
IF Days_till_next_month < No_of_days
No_of_months = No_of_months + 1
No_of_days = No_of_days - Days_till_next_month
if Start_Month_No = 12
Start_Month_No = 1
else
Start_Month_No = Start_Month_No + 1
endif
EndIf
ENDDO
** We now have Numerical quantities for
** No_of_years, No_of_months and No_of Days
** Simply format this into a string and return value.
Return_String = alltrim(str(No_of_years) + " years, "+
alltrim(str(No_of_months) + " months, "+
alltrim(str(No_of_days) + " days."
RETURN Return_String
*** End Function TimeString
FUNCTION GetDays(MonthNo)
PRIVATE Days_In_Month
*
DO CASE
CASE MonthNo = 1 && January
Days_In_Month = 31
CASE Month_No = 2
Days_In_Month = 28
CASE
CASE ETC
CASE Month_No = 12
Days_In_Month = 31
ENDCASE
RETURN Days_In_Month
*** End Function GetDays
====================================================
Finally, you will need to make a 1 day adjustment to the
above functions for when the year passes by a leap year
and also when the no_of_days passes through February and it
is a leap year. I leave it to you to fill in this part.
Hope this helps.
AliFox.