-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathptime_util.go
284 lines (268 loc) · 12.3 KB
/
ptime_util.go
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
package main
import (
"strings"
"time"
)
func get_date(in *string) {
nowTime := time.Now()
minut := nowTime.Add(-time.Minute * 0)
p1minut := nowTime.Add(-time.Minute * 1)
p2minut := nowTime.Add(-time.Minute * -2)
p3minut := nowTime.Add(-time.Minute * -3)
p4minut := nowTime.Add(-time.Minute * -4)
p5minut := nowTime.Add(-time.Minute * -5)
p6minut := nowTime.Add(-time.Minute * -6)
p7minut := nowTime.Add(-time.Minute * -7)
p8minut := nowTime.Add(-time.Minute * -8)
p9minut := nowTime.Add(-time.Minute * -9)
p10minut := nowTime.Add(-time.Minute * -10)
p15minut := nowTime.Add(-time.Minute * -15)
p20minut := nowTime.Add(-time.Minute * -20)
p25minut := nowTime.Add(-time.Minute * -25)
p30minut := nowTime.Add(-time.Minute * -30)
p35minut := nowTime.Add(-time.Minute * -35)
p40minut := nowTime.Add(-time.Minute * -40)
p45minut := nowTime.Add(-time.Minute * -45)
p50minut := nowTime.Add(-time.Minute * -50)
p55minut := nowTime.Add(-time.Minute * -55)
today := nowTime.AddDate(0, 0, 0)
p1day := nowTime.AddDate(0, 0, -1)
p2day := nowTime.AddDate(0, 0, -2)
p3day := nowTime.AddDate(0, 0, -3)
p4day := nowTime.AddDate(0, 0, -4)
p5day := nowTime.AddDate(0, 0, -5)
p6day := nowTime.AddDate(0, 0, -6)
p7day := nowTime.AddDate(0, 0, -7)
p8day := nowTime.AddDate(0, 0, -8)
p9day := nowTime.AddDate(0, 0, -9)
p10day := nowTime.AddDate(0, 0, -10)
p11day := nowTime.AddDate(0, 0, -11)
p12day := nowTime.AddDate(0, 0, -12)
p13day := nowTime.AddDate(0, 0, -13)
p14day := nowTime.AddDate(0, 0, -14)
p15day := nowTime.AddDate(0, 0, -15)
p16day := nowTime.AddDate(0, 0, -16)
p17day := nowTime.AddDate(0, 0, -17)
p18day := nowTime.AddDate(0, 0, -18)
p19day := nowTime.AddDate(0, 0, -19)
p20day := nowTime.AddDate(0, 0, -20)
p21day := nowTime.AddDate(0, 0, -21)
p22day := nowTime.AddDate(0, 0, -22)
p23day := nowTime.AddDate(0, 0, -23)
p24day := nowTime.AddDate(0, 0, -24)
p25day := nowTime.AddDate(0, 0, -25)
p26day := nowTime.AddDate(0, 0, -26)
p27day := nowTime.AddDate(0, 0, -27)
p28day := nowTime.AddDate(0, 0, -28)
p29day := nowTime.AddDate(0, 0, -29)
p30day := nowTime.AddDate(0, 0, -30)
p31day := nowTime.AddDate(0, 0, -31)
p60day := nowTime.AddDate(0, 0, -60)
p90day := nowTime.AddDate(0, 0, -90)
p180day := nowTime.AddDate(0, 0, -90)
thismonth := nowTime.AddDate(0, 0, 0)
p1month := nowTime.AddDate(0, -1, 0)
p2month := nowTime.AddDate(0, -2, 0)
p3month := nowTime.AddDate(0, -3, 0)
p4month := nowTime.AddDate(0, -4, 0)
p5month := nowTime.AddDate(0, -5, 0)
p6month := nowTime.AddDate(0, -6, 0)
p7month := nowTime.AddDate(0, -7, 0)
p8month := nowTime.AddDate(0, -8, 0)
p9month := nowTime.AddDate(0, -9, 0)
p10month := nowTime.AddDate(0, -10, 0)
p11month := nowTime.AddDate(0, -11, 0)
p12month := nowTime.AddDate(0, -12, 0)
thisyear := nowTime.AddDate(0, 0, 0)
p1year := nowTime.AddDate(1, 0, 0)
p2year := nowTime.AddDate(2, 0, 0)
p3year := nowTime.AddDate(3, 0, 0)
currentYear, currentMonth, _ := nowTime.Date()
currentLocation := nowTime.Location()
firstOfMonth := time.Date(currentYear, currentMonth, 1, 0, 0, 0, 0, currentLocation)
lastOfMonth := firstOfMonth.AddDate(0, 1, -1)
firstOf1Month := firstOfMonth.AddDate(0, -1, 0)
lastOf1Month := lastOfMonth.AddDate(0, -1, 0)
firstOf2Month := firstOf1Month.AddDate(0, -1, 0)
lastOf2Month := lastOf1Month.AddDate(0, -1, 0)
firstOf3Month := firstOf2Month.AddDate(0, -1, 0)
lastOf3Month := lastOf2Month.AddDate(0, -1, 0)
firstOf4Month := firstOf3Month.AddDate(0, -1, 0)
lastOf4Month := lastOf3Month.AddDate(0, -1, 0)
firstOf5Month := firstOf4Month.AddDate(0, -1, 0)
lastOf5Month := lastOf4Month.AddDate(0, -1, 0)
firstOf6Month := firstOf5Month.AddDate(0, -1, 0)
lastOf6Month := lastOf5Month.AddDate(0, -1, 0)
resminut := minut.Format("200601021504")
res1minut := p1minut.Format("200601021504")
res2minut := p2minut.Format("200601021504")
res3minut := p3minut.Format("200601021504")
res4minut := p4minut.Format("200601021504")
res5minut := p5minut.Format("200601021504")
res6minut := p6minut.Format("200601021504")
res7minut := p7minut.Format("200601021504")
res8minut := p8minut.Format("200601021504")
res9minut := p9minut.Format("200601021504")
res10minut := p10minut.Format("200601021504")
res15minut := p15minut.Format("200601021504")
res20minut := p20minut.Format("200601021504")
res25minut := p25minut.Format("200601021504")
res30minut := p30minut.Format("200601021504")
res35minut := p35minut.Format("200601021504")
res40minut := p40minut.Format("200601021504")
res45minut := p45minut.Format("200601021504")
res50minut := p50minut.Format("200601021504")
res55minut := p55minut.Format("200601021504")
resday := today.Format("20060102")
res1day := p1day.Format("20060102")
res2day := p2day.Format("20060102")
res3day := p3day.Format("20060102")
res4day := p4day.Format("20060102")
res5day := p5day.Format("20060102")
res6day := p6day.Format("20060102")
res7day := p7day.Format("20060102")
res8day := p8day.Format("20060102")
res9day := p9day.Format("20060102")
res10day := p10day.Format("20060102")
res11day := p11day.Format("20060102")
res12day := p12day.Format("20060102")
res13day := p13day.Format("20060102")
res14day := p14day.Format("20060102")
res15day := p15day.Format("20060102")
res16day := p16day.Format("20060102")
res17day := p17day.Format("20060102")
res18day := p18day.Format("20060102")
res19day := p19day.Format("20060102")
res20day := p20day.Format("20060102")
res21day := p21day.Format("20060102")
res22day := p22day.Format("20060102")
res23day := p23day.Format("20060102")
res24day := p24day.Format("20060102")
res25day := p25day.Format("20060102")
res26day := p26day.Format("20060102")
res27day := p27day.Format("20060102")
res28day := p28day.Format("20060102")
res29day := p29day.Format("20060102")
res30day := p30day.Format("20060102")
res31day := p31day.Format("20060102")
res60day := p60day.Format("20060102")
res90day := p90day.Format("20060102")
res180day := p180day.Format("20060102")
resmonth := thismonth.Format("200601")
res1month := p1month.Format("200601")
res2month := p2month.Format("200601")
res3month := p3month.Format("200601")
res4month := p4month.Format("200601")
res5month := p5month.Format("200601")
res6month := p6month.Format("200601")
res7month := p7month.Format("200601")
res8month := p8month.Format("200601")
res9month := p9month.Format("200601")
res10month := p10month.Format("200601")
res11month := p11month.Format("200601")
res12month := p12month.Format("200601")
resyear := thisyear.Format("2006")
res1year := p1year.Format("2006")
res2year := p2year.Format("2006")
res3year := p3year.Format("2006")
resfirstOfMonth := firstOfMonth.Format("20060102")
reslastOfMonth := lastOfMonth.Format("20060102")
resfirstOf1Month := firstOf1Month.Format("20060102")
reslastOf1Month := lastOf1Month.Format("20060102")
resfirstOf2Month := firstOf2Month.Format("20060102")
reslastOf2Month := lastOf2Month.Format("20060102")
resfirstOf3Month := firstOf3Month.Format("20060102")
reslastOf3Month := lastOf3Month.Format("20060102")
resfirstOf4Month := firstOf4Month.Format("20060102")
reslastOf4Month := lastOf4Month.Format("20060102")
resfirstOf5Month := firstOf5Month.Format("20060102")
reslastOf5Month := lastOf5Month.Format("20060102")
resfirstOf6Month := firstOf6Month.Format("20060102")
reslastOf6Month := lastOf6Month.Format("20060102")
*in = strings.Replace(*in, "${today}", resday, -1)
*in = strings.Replace(*in, "${p1day}", res1day, -1)
*in = strings.Replace(*in, "${p2day}", res2day, -1)
*in = strings.Replace(*in, "${p3day}", res3day, -1)
*in = strings.Replace(*in, "${p4day}", res4day, -1)
*in = strings.Replace(*in, "${p5day}", res5day, -1)
*in = strings.Replace(*in, "${p6day}", res6day, -1)
*in = strings.Replace(*in, "${p7day}", res7day, -1)
*in = strings.Replace(*in, "${p8day}", res8day, -1)
*in = strings.Replace(*in, "${p9day}", res9day, -1)
*in = strings.Replace(*in, "${p10day}", res10day, -1)
*in = strings.Replace(*in, "${p11day}", res11day, -1)
*in = strings.Replace(*in, "${p12day}", res12day, -1)
*in = strings.Replace(*in, "${p13day}", res13day, -1)
*in = strings.Replace(*in, "${p14day}", res14day, -1)
*in = strings.Replace(*in, "${p15day}", res15day, -1)
*in = strings.Replace(*in, "${p16day}", res16day, -1)
*in = strings.Replace(*in, "${p17day}", res17day, -1)
*in = strings.Replace(*in, "${p18day}", res18day, -1)
*in = strings.Replace(*in, "${p19day}", res19day, -1)
*in = strings.Replace(*in, "${p20day}", res20day, -1)
*in = strings.Replace(*in, "${p21day}", res21day, -1)
*in = strings.Replace(*in, "${p22day}", res22day, -1)
*in = strings.Replace(*in, "${p23day}", res23day, -1)
*in = strings.Replace(*in, "${p24day}", res24day, -1)
*in = strings.Replace(*in, "${p25day}", res25day, -1)
*in = strings.Replace(*in, "${p26day}", res26day, -1)
*in = strings.Replace(*in, "${p27day}", res27day, -1)
*in = strings.Replace(*in, "${p28day}", res28day, -1)
*in = strings.Replace(*in, "${p29day}", res29day, -1)
*in = strings.Replace(*in, "${p30day}", res30day, -1)
*in = strings.Replace(*in, "${p31day}", res31day, -1)
*in = strings.Replace(*in, "${p60day}", res60day, -1)
*in = strings.Replace(*in, "${p90day}", res90day, -1)
*in = strings.Replace(*in, "${p180day}", res180day, -1)
*in = strings.Replace(*in, "${month}", resmonth, -1)
*in = strings.Replace(*in, "${p1month}", res1month, -1)
*in = strings.Replace(*in, "${p2month}", res2month, -1)
*in = strings.Replace(*in, "${p3month}", res3month, -1)
*in = strings.Replace(*in, "${p4month}", res4month, -1)
*in = strings.Replace(*in, "${p5month}", res5month, -1)
*in = strings.Replace(*in, "${p6month}", res6month, -1)
*in = strings.Replace(*in, "${p7month}", res7month, -1)
*in = strings.Replace(*in, "${p8month}", res8month, -1)
*in = strings.Replace(*in, "${p9month}", res9month, -1)
*in = strings.Replace(*in, "${p10month}", res10month, -1)
*in = strings.Replace(*in, "${p11month}", res11month, -1)
*in = strings.Replace(*in, "${p12month}", res12month, -1)
*in = strings.Replace(*in, "${year}", resyear, -1)
*in = strings.Replace(*in, "${p1year}", res1year, -1)
*in = strings.Replace(*in, "${p2year}", res2year, -1)
*in = strings.Replace(*in, "${p3year}", res3year, -1)
*in = strings.Replace(*in, "${minut}", resminut, -1)
*in = strings.Replace(*in, "${p1minut}", res1minut, -1)
*in = strings.Replace(*in, "${p2minut}", res2minut, -1)
*in = strings.Replace(*in, "${p3minut}", res3minut, -1)
*in = strings.Replace(*in, "${p4minut}", res4minut, -1)
*in = strings.Replace(*in, "${p5minut}", res5minut, -1)
*in = strings.Replace(*in, "${p6minut}", res6minut, -1)
*in = strings.Replace(*in, "${p7minut}", res7minut, -1)
*in = strings.Replace(*in, "${p8minut}", res8minut, -1)
*in = strings.Replace(*in, "${p9minut}", res9minut, -1)
*in = strings.Replace(*in, "${p10minut}", res10minut, -1)
*in = strings.Replace(*in, "${p15minut}", res15minut, -1)
*in = strings.Replace(*in, "${p20minut}", res20minut, -1)
*in = strings.Replace(*in, "${p25minut}", res25minut, -1)
*in = strings.Replace(*in, "${p30minut}", res30minut, -1)
*in = strings.Replace(*in, "${p35minut}", res35minut, -1)
*in = strings.Replace(*in, "${p40minut}", res40minut, -1)
*in = strings.Replace(*in, "${p45minut}", res45minut, -1)
*in = strings.Replace(*in, "${p50minut}", res50minut, -1)
*in = strings.Replace(*in, "${p55minut}", res55minut, -1)
*in = strings.Replace(*in, "${firstOfMonth}", resfirstOfMonth, -1)
*in = strings.Replace(*in, "${lastOfMonth}", reslastOfMonth, -1)
*in = strings.Replace(*in, "${firstOf1Month}", resfirstOf1Month, -1)
*in = strings.Replace(*in, "${lastOf1Month}", reslastOf1Month, -1)
*in = strings.Replace(*in, "${firstOf2Month}", resfirstOf2Month, -1)
*in = strings.Replace(*in, "${lastOf2Month}", reslastOf2Month, -1)
*in = strings.Replace(*in, "${firstOf3Month}", resfirstOf3Month, -1)
*in = strings.Replace(*in, "${lastOf3Month}", reslastOf3Month, -1)
*in = strings.Replace(*in, "${firstOf4Month}", resfirstOf4Month, -1)
*in = strings.Replace(*in, "${lastO4fMonth}", reslastOf4Month, -1)
*in = strings.Replace(*in, "${firstOf5Month}", resfirstOf5Month, -1)
*in = strings.Replace(*in, "${lastOf5Month}", reslastOf5Month, -1)
*in = strings.Replace(*in, "${firstOf6Month}", resfirstOf6Month, -1)
*in = strings.Replace(*in, "${lastOf6Month}", reslastOf6Month, -1)
}