-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathDateBuildRangeHeaders.calc
75 lines (68 loc) · 1.9 KB
/
DateBuildRangeHeaders.calc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
Let ( [
start = GetAsDate ( startDate ) ;
startMonth = Month ( start ) ;
startYear = Year ( start ) ;
startDay = Day ( start ) ;
end = GetAsDate ( endDate ) ;
//-- Adjust here for incrementations beside "month"
string =
Case (
interval = "month" ;
Let ( [
searchEnd = Date ( startMonth + 1 ; 0 ; startYear ) ;
$searchEnd = If ( searchEnd > end ; end ; searchEnd ) ;
$searchNext = GetAsDate ( $searchEnd + 1 )
];
DateMonthName ( startMonth ; 1 ) & " '" & Right ( startYear ; 2 )
) ;
interval = "week" ;
Let ( [
searchEnd = Date ( startMonth ; startDay + 7 ; startYear ) ;
$searchEnd = If ( searchEnd > end ; end ; searchEnd ) ;
$searchNext = GetAsDate ( $searchEnd + 1 )
];
"'" & Right ( startYear ; 2 ) & " Week " & WeekOfYear ( start )
) ;
interval = "day" ;
Let ( [
searchEnd = start ;
$searchEnd = If ( searchEnd > end ; end ; searchEnd ) ;
$searchNext = GetAsDate ( $searchEnd + 1 )
];
DateMonthName ( startMonth ; 1 ) & " " & startDay & ", " & startYear
) ;
interval = "year" ;
Let ( [
searchEnd = Date ( startMonth ; startDay ; startYear + 1 ) ;
$searchEnd =
Case (
searchEnd > nextYearStart ;
GetAsDate ( nextYearStart - 1 ) ;
searchEnd > end ;
end ;
searchEnd
) ;
$searchNext = GetAsDate ( $searchEnd + 1 )
];
startYear
) ;
end
)
] ;
string &
Case (
$searchEnd < end ;
¶ & DateBuildRangeHeaders ( $searchNext ; end ; interval ; format )
)
)
/* —————————————————————————————— //
NAME:
DateBuildRangeHeaders ( startDate ; endDate ; interval ; format )
PURPOSE:
Builds return-delimited list of dates in designated format
EXAMPLES:
HISTORY:
Created: 2010-Aug-05 15h07 PST — Donovan A. Chandler
NOTES:
format parameter intended for future enhancement
*/