DateDiff.AddDays
string sReturnedDate = DateDiff.AddDays(string sDate, number nDays)
returns a date that is incremented by the
number of days specified in nDays
Example:
--add 15 days to 01/22/2005
sNewDate = DateDiff.AddDays("01/22/2005", 15);
DateDiff.AddMonths
string sReturnedDate = DateDiff.AddMonths(string sDate, number nMonths)
returns a date that is incremented by the
number of months specified in nMonths
Example:
--add 15 months to 12/25/2005
sNewDate = DateDiff.AddMonths("12/25/2005", 15);
DateDiff.AddYears
string sReturnedDate = DateDiff.AddYears(string sDate, number nYears)
returns a date that is incremented by the
number of years specified in nYears
Example:
--add 8 years to 07/25/2005
sNewDate = DateDiff.AddYears("07/25/2005", 8);
DateDiff.FormatSeconds
string sTime = DateDiff.FormatSeconds(number nSeconds)
returns a formatted string HH:MM:SS
Example:
--display hours, minutes and seconds in 3661 seconds
sTime = DateDiff.FormatSeconds(3661);
Dialog.Message("Elapsed Time", "The time that has
elapsed is: " .. sTime);
DateDiff.GetDayOfWeek
number sReturnedDate = DateDiff.GetDayOfWeek(string sDate)
returns a numeric value that represents the
day of the week
| Sunday |
= |
1 |
| Monday |
= |
2 |
| Tuesday |
= |
3 |
| Wednesday |
= |
4 |
| Thursday |
= |
5 |
| Friday |
= |
6 |
| Saturday |
= |
7 |
| Invalid Date |
= |
-1 |
Example:
--set up a table for the days of the week
tblDaysOfWeek = {"Sunday", "Monday",
"Tuesday", "Wednesday", "Thursday",
"Friday", "Saturday"};
--get the day of the week
nDay = DateDiff.GetDayOfWeek("07/25/2005");
if nDay ~= -1 then
Dialog.Message("Day of Week",
"The day of the week that 07/25/2005 falls on is "..
tblDaysOfWeek[nDay]);
else
Dialog.Message("Day of Week",
"Invalid date format.");
end
DateDiff.GetDifference
number nDays = DateDiff.GetDifference(string sBeginningDate, string
sEndingDate)
returns the number of days between the
dates. If the result is negative, one or both of the dates
passed was in a invalid format.
Example:
--find out how many days to christmas
sToday = System.GetDate(DATE_FMT_US);
nDays = DateDiff.GetDifference(sToday, "12/25/2005");
if nDays ~= -1 then
Dialog.Message("Days til Christmas", "There are ".. nDays .. " day(s) until Chritmas");;
else
Dialog.Message("Days til
Christmas", "Invalid date format.");
end
DateDiff.GetJulian
number nJulianDate = DateDiff.GetJulian(string sDate)
returns the date in Julian format
Example:
--get the Julian date for 5/2/2005
nJulianDate = DateDiff.GetJulian("05/02/2005")
DateDiff.IsEqual
boolean bIsEqual = DateDiff.IsEqual(string sDate1, string sDate2)
returns a true if the dates passed are equal,
false if not or if an invalid date format is passed
Example:
--compare dates
if DateDiff.IsEqual("2/29/2005", "2/29/2006")
then
Dialog.Message("Compare Dates",
"The dates are equal.");;
else
Dialog.Message("Compare Dates", "The
dates are NOT equal.");
end
DateDiff.IsGreaterThan
boolean bGreater = DateDiff.IsGreaterThan(string sDate1, string
sDate2)
returns a true if Date1 is greater than Date2,
false if not
Example:
--compare dates
if DateDiff.IsGreaterThan("2/29/2005",
"2/29/2006") then
Dialog.Message("Compare Dates",
"Date1 was greater.");;
else
Dialog.Message("Compare Dates",
"Date2 was greater.");
end
DateDiff.IsLessThan
boolean bLess = DateDiff.IsGreaterThan(string sDate1, string sDate2)
returns a true if Date1 is less than Date2,
false if not
Example:
--compare dates
if DateDiff.IsGreaterThan("2/29/2005",
"2/29/2006") then
Dialog.Message("Compare Dates",
"Date1 was a lesser value.");;
else
Dialog.Message("Compare Dates",
"Date2 was a lesser value.");
end
DateDiff.IsValid
boolean bVallid = DateDiff.IsValid(string sDate)
returns a true if the date is a valid date
Example:
--check date
if DateDiff.IsValid("2/29/2005") then
Dialog.Message("Leap Year",
"It's a leap year.");;
else
Dialog.Message("Compare Dates",
"It's not a leap year.");
end
DateDiff.SubtractDays
string sReturnedDate = DateDiff.SubtractDays(string sDate, number nDays)
returns a date that is decremented by the
number of days specified in nDays
Example:
--subtract 15 days to 01/22/2005
sNewDate = DateDiff.SubtractDays("01/22/2005", 15)
DateDiff.SubtractMonths
string sReturnedDate = DateDiff.SubtractMonths(string sDate, number
nMonths)
returns a date that is decremented by the
number of months specified in nMonths
Example:
--subtract 15 months to 12/25/2005
sNewDate = DateDiff.AddMonths("12/25/2005", 15)
DateDiff.SubtractYears
string sReturnedDate = DateDiff.SubtractYears(string sDate, number
nYears)
returns a date that is decremented by the
number of years specified in nYears
Example:
--subtract 8 years to 07/25/2005
sNewDate = DateDiff.AddYears("07/25/2005", 8)
|