stsDateMath
|
|
stsDateMath(date1,mathOpereation,numberOrDate2,returnFormat)
put stsDateMath("9/26/03","+","4","days")
--> 09/30/03 2:00 AM
put stsGetFileListing("/Users/kenray/MyFolder",".jpg","true")
Gets a list of full paths to files. You can format the result using stsFormatFileListing.
- folderName is the path to the folder from which you want the listing.
- filterType allows you to filter the file(s) that get returned either by passing the eight character type/creator used on Macs, or the file extension (used in OS X, Windows, and Unix). If not provided, filterType is assumed to be "", and will not filter any of the files.
- isRecursive determines whether the listing should continue to wend through subfolders untile a complete hierarchical listing is returned. If not provided, isRecursive is assumed to be "false".
- includeInvisibles determines whether to return invisible files (those that start with ".") on OS X or Unix. (Under Windows, this parameter is ignored and you get all the files, hidden or not).
function stsDateMath pDate1,pOperation,pNumberOrDate2,pReturnVal set the useSystemDate to true convert pDate1 to seconds if the result is "invalid date" then return "STSError: Invalid Date" if isNumber(pNumberOrDate2) then -- adding/subtracting date chunks switch pReturnVal case "hour" case "hours" case "hr" case "hrs" put (pNumberOrDate2 * 60 * 60) into tVal break case "min" case "mins" case "minute" case "minutes" put (pNumberOrDate2 * 60) into tVal break case "days" case "day" put (pNumberOrDate2*86400) into tVal break case "week" case "weeks" put (pNumberOrDate2*86400*7) into tVal break end switch do "put (" & pDate1 && pOperation && tVal & ") into tRetVal" convert tRetVal to short date and short time else convert pNumberOrDate2 to seconds if the result is "invalid date" then return "STSError: Invalid Date" do "put (" & pDate1 && pOperation && pNumberOrDate2 & ") into tRetVal" if pOperation = "-" then switch pReturnVal case "min" case "mins" case "minute" case "minutes" return (tRetVal/60) break case "days" case "day" return (tRetVal/86400) break case "week" case "weeks" return ((tRetVal/86400)/7) break case "weeks,days" put trunc((tRetVal/86400)/7) into tWeeks put ((tRetVal-(tWeeks*7*86400))/86400) into tDays return tWeeks,tDays break end switch end if end if return tRetVal end stsDateMath