SortMonthShortNames Function
Provides a means to sort month names by their numbers.
[ActiveDocument.]SortMonthShortNames (a, b)
Array.sort([ActiveDocument.]SortMonthShortNames)
Arguments
- a
- Required. The first value to use in the comparison.
- b
- Required. The second value to use in the comparison.
Return Value
The SortMonthShortNames function returns the following values:
If |
SortMonthShortNames returns |
Neither a nor b is in the MonthName array and a = "Mo25" |
-1 |
Neither a nor b is in the MonthName array and b = "Mo25" |
1 |
Neither a nor b is in the MonthName array and Neither a nor b = "Mo25"
a == b |
0 |
a < b |
-1 |
a > b |
1 |
|
a is not in the MonthName array |
1 |
b is not in the MonthName array |
-1 |
a nor b are both in the MonthName array |
month number of a minus month number of b |
Remarks
The following example uses SortMonthShortNames to sort a list of months by month number:
var arr = new Array("Apr", "Aug", "Dec", "Feb", "Jan", "Jul", "Jun", "Mar", "May", "Nov", "Oct", "Sep");
arr.sort(SortMonthShortNames);
Console.Writeln(arr.toString()); // returns Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec
Requirements