func XDaysAgo : string param integer iDaysAgo integer iDay, iMonth, iYear, iHour, iMin, iSec long lDate string sDate lDate = $LTIME - (86400 * iDaysAgo) ;Derive timeval for specified num. of days ago ltimeints lDate iYear iMonth iDay iHour iMin iSec ;Convert timeval to integer components strfmt sDate "%02d%02d%d" iMonth iDay iYear ;Create MMDDYYYY string strdelete sDate 4 2 ;Delete first two numbers from year value return sDate endfunc func LastMonth : string integer iDay, iMonth, iYear, iHour, iMin, iSec string sDate ltimeints $LTIME iYear iMonth iDay iHour iMin iSec ;Convert timeval to integer components if iMonth == 1 ;If currently January iMonth = 12 ;Then assign month to December iYear-- ;And decrement year by one else iMonth-- ;Otherwise just move month value back by one endif iDay = 1 ;First day of the month strfmt sDate "%02d%02d%d" iMonth iDay iYear ;Create MMDDYYYY string strdelete sDate 4 2 ;Delete first two numbers from year value return sDate endfunc