line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Venus::Date; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
65
|
use 5.018; |
|
2
|
|
|
|
|
9
|
|
4
|
|
|
|
|
|
|
|
5
|
2
|
|
|
2
|
|
12
|
use strict; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
52
|
|
6
|
2
|
|
|
2
|
|
10
|
use warnings; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
80
|
|
7
|
|
|
|
|
|
|
|
8
|
2
|
|
|
2
|
|
11
|
use Venus::Class 'attr', 'base', 'with'; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
18
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
base 'Venus::Kind::Utility'; |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
with 'Venus::Role::Buildable'; |
13
|
|
|
|
|
|
|
with 'Venus::Role::Explainable'; |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
use overload ( |
16
|
|
|
|
|
|
|
'""' => 'explain', |
17
|
1
|
|
|
1
|
|
6
|
'!=' => sub{("$_[0]" + 0) != ($_[1] + 0)}, |
18
|
2
|
|
|
2
|
|
7
|
'+' => sub{("$_[0]" + 0) + ($_[1] + 0)}, |
19
|
1
|
|
|
1
|
|
5
|
'-' => sub{("$_[0]" + 0) - ($_[1] + 0)}, |
20
|
198
|
|
|
198
|
|
14470
|
'0+' => sub{($_[0]->epoch + 0)}, |
21
|
1
|
|
|
1
|
|
36
|
'<' => sub{("$_[0]" + 0) < ($_[1] + 0)}, |
22
|
1
|
|
|
1
|
|
5
|
'<=' => sub{("$_[0]" + 0) <= ($_[1] + 0)}, |
23
|
1
|
|
|
1
|
|
5
|
'==' => sub{("$_[0]" + 0) == ($_[1] + 0)}, |
24
|
1
|
|
|
1
|
|
5
|
'>' => sub{("$_[0]" + 0) > ($_[1] + 0)}, |
25
|
1
|
|
|
1
|
|
12
|
'>=' => sub{("$_[0]" + 0) >= ($_[1] + 0)}, |
26
|
1
|
|
|
1
|
|
3
|
'eq' => sub{"$_[0]" eq "$_[1]"}, |
27
|
1
|
|
|
1
|
|
5
|
'ne' => sub{"$_[0]" ne "$_[1]"}, |
28
|
2
|
|
|
|
|
54
|
'~~' => 'explain', |
29
|
|
|
|
|
|
|
fallback => 1, |
30
|
2
|
|
|
2
|
|
15
|
); |
|
2
|
|
|
|
|
6
|
|
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
# ATTRIBUTES |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
attr 'day'; |
35
|
|
|
|
|
|
|
attr 'month'; |
36
|
|
|
|
|
|
|
attr 'year'; |
37
|
|
|
|
|
|
|
attr 'hour'; |
38
|
|
|
|
|
|
|
attr 'minute'; |
39
|
|
|
|
|
|
|
attr 'second'; |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
# BUILDERS |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
sub build_arg { |
44
|
93
|
|
|
93
|
0
|
256
|
my ($self, $time) = @_; |
45
|
|
|
|
|
|
|
|
46
|
93
|
|
|
|
|
223
|
my $data = {}; |
47
|
93
|
|
|
|
|
691
|
my @time = gmtime $time; |
48
|
|
|
|
|
|
|
|
49
|
93
|
|
33
|
|
|
522
|
$data->{day} //= $time[3]; |
50
|
93
|
|
66
|
|
|
446
|
$data->{hour} //= $time[2]; |
51
|
93
|
|
66
|
|
|
437
|
$data->{minute} //= $time[1]; |
52
|
93
|
|
33
|
|
|
443
|
$data->{month} //= $time[4] + 1; |
53
|
93
|
|
66
|
|
|
457
|
$data->{second} //= $time[0]; |
54
|
93
|
|
33
|
|
|
430
|
$data->{year} //= $time[5] + 1900; |
55
|
|
|
|
|
|
|
|
56
|
93
|
|
|
|
|
318
|
return $data; |
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
sub build_args { |
60
|
96
|
|
|
96
|
0
|
247
|
my ($self, $data) = @_; |
61
|
|
|
|
|
|
|
|
62
|
96
|
|
|
|
|
407
|
my @time = gmtime time; |
63
|
|
|
|
|
|
|
|
64
|
96
|
|
33
|
|
|
290
|
$data->{day} //= $time[3]; |
65
|
96
|
|
66
|
|
|
243
|
$data->{hour} //= $time[2]; |
66
|
96
|
|
66
|
|
|
253
|
$data->{minute} //= $time[1]; |
67
|
96
|
|
33
|
|
|
323
|
$data->{month} //= $time[4] + 1; |
68
|
96
|
|
66
|
|
|
219
|
$data->{second} //= $time[0]; |
69
|
96
|
|
33
|
|
|
249
|
$data->{year} //= $time[5] + 1900; |
70
|
|
|
|
|
|
|
|
71
|
96
|
|
|
|
|
276
|
return $data; |
72
|
|
|
|
|
|
|
} |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
# METHODS |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
sub add { |
77
|
8
|
|
|
8
|
1
|
20
|
my ($self, $data) = @_; |
78
|
|
|
|
|
|
|
|
79
|
8
|
|
|
|
|
24
|
for my $name (qw(days hours minutes months seconds years)) { |
80
|
48
|
50
|
|
|
|
258
|
if (my $code = $self->can("add_$name")) { |
81
|
48
|
|
|
|
|
184
|
$self->$code($data->{$name}); |
82
|
|
|
|
|
|
|
} |
83
|
|
|
|
|
|
|
} |
84
|
|
|
|
|
|
|
|
85
|
8
|
|
|
|
|
105
|
return $self; |
86
|
|
|
|
|
|
|
} |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
sub add_days { |
89
|
11
|
|
|
11
|
1
|
32
|
my ($self, $size) = @_; |
90
|
|
|
|
|
|
|
|
91
|
11
|
|
100
|
|
|
36
|
$size //= 0; |
92
|
|
|
|
|
|
|
|
93
|
11
|
100
|
|
|
|
52
|
$size = ($self->timeseconds->ONE_DAY * $size) if $size; |
94
|
|
|
|
|
|
|
|
95
|
11
|
|
|
|
|
133
|
return $self->reset($self->epoch + $size); |
96
|
|
|
|
|
|
|
} |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
sub add_hours { |
99
|
11
|
|
|
11
|
1
|
52
|
my ($self, $size) = @_; |
100
|
|
|
|
|
|
|
|
101
|
11
|
|
100
|
|
|
41
|
$size //= 0; |
102
|
|
|
|
|
|
|
|
103
|
11
|
100
|
|
|
|
44
|
$size = ($self->timeseconds->ONE_HOUR * $size) if $size; |
104
|
|
|
|
|
|
|
|
105
|
11
|
|
|
|
|
109
|
return $self->reset($self->epoch + $size); |
106
|
|
|
|
|
|
|
} |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
sub add_hms { |
109
|
3
|
|
|
3
|
1
|
10
|
my ($self, $h, $m, $s) = @_; |
110
|
|
|
|
|
|
|
|
111
|
3
|
|
|
|
|
8
|
my $data = {}; |
112
|
|
|
|
|
|
|
|
113
|
3
|
100
|
|
|
|
13
|
$data->{hours} = $h if defined $h; |
114
|
3
|
50
|
|
|
|
15
|
$data->{minutes} = $m if defined $m; |
115
|
3
|
100
|
|
|
|
11
|
$data->{seconds} = $s if defined $s; |
116
|
|
|
|
|
|
|
|
117
|
3
|
|
|
|
|
13
|
return $self->add($data); |
118
|
|
|
|
|
|
|
} |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
sub add_mdy { |
121
|
3
|
|
|
3
|
1
|
10
|
my ($self, $m, $d, $y) = @_; |
122
|
|
|
|
|
|
|
|
123
|
3
|
|
|
|
|
7
|
my $data = {}; |
124
|
|
|
|
|
|
|
|
125
|
3
|
50
|
|
|
|
12
|
$data->{days} = $d if defined $d; |
126
|
3
|
100
|
|
|
|
9
|
$data->{months} = $m if defined $m; |
127
|
3
|
100
|
|
|
|
11
|
$data->{years} = $y if defined $y; |
128
|
|
|
|
|
|
|
|
129
|
3
|
|
|
|
|
10
|
return $self->add($data); |
130
|
|
|
|
|
|
|
} |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
sub add_minutes { |
133
|
11
|
|
|
11
|
1
|
36
|
my ($self, $size) = @_; |
134
|
|
|
|
|
|
|
|
135
|
11
|
|
100
|
|
|
36
|
$size //= 0; |
136
|
|
|
|
|
|
|
|
137
|
11
|
100
|
|
|
|
35
|
$size = ($self->timeseconds->ONE_MINUTE * $size) if $size; |
138
|
|
|
|
|
|
|
|
139
|
11
|
|
|
|
|
90
|
return $self->reset($self->epoch + $size); |
140
|
|
|
|
|
|
|
} |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
sub add_months { |
143
|
11
|
|
|
11
|
1
|
43
|
my ($self, $size) = @_; |
144
|
|
|
|
|
|
|
|
145
|
11
|
|
100
|
|
|
57
|
$size //= 0; |
146
|
|
|
|
|
|
|
|
147
|
11
|
100
|
|
|
|
39
|
$size = ($self->timeseconds->ONE_MONTH * $size) if $size; |
148
|
|
|
|
|
|
|
|
149
|
11
|
|
|
|
|
105
|
return $self->reset($self->epoch + $size); |
150
|
|
|
|
|
|
|
} |
151
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
sub add_seconds { |
153
|
11
|
|
|
11
|
1
|
38
|
my ($self, $size) = @_; |
154
|
|
|
|
|
|
|
|
155
|
11
|
|
100
|
|
|
40
|
$size //= 0; |
156
|
|
|
|
|
|
|
|
157
|
11
|
|
|
|
|
29
|
return $self->reset($self->epoch + $size); |
158
|
|
|
|
|
|
|
} |
159
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
sub add_years { |
161
|
11
|
|
|
11
|
1
|
41
|
my ($self, $size) = @_; |
162
|
|
|
|
|
|
|
|
163
|
11
|
|
100
|
|
|
50
|
$size //= 0; |
164
|
|
|
|
|
|
|
|
165
|
11
|
100
|
|
|
|
46
|
$size = ($self->timeseconds->ONE_YEAR * $size) if $size; |
166
|
|
|
|
|
|
|
|
167
|
11
|
|
|
|
|
96
|
return $self->reset($self->epoch + $size); |
168
|
|
|
|
|
|
|
} |
169
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
sub assertion { |
171
|
0
|
|
|
0
|
1
|
0
|
my ($self) = @_; |
172
|
|
|
|
|
|
|
|
173
|
0
|
|
|
|
|
0
|
my $assertion = $self->SUPER::assertion; |
174
|
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
$assertion->match('number')->format(sub{ |
176
|
0
|
|
0
|
0
|
|
0
|
(ref $self || $self)->new($_) |
177
|
0
|
|
|
|
|
0
|
}); |
178
|
|
|
|
|
|
|
|
179
|
0
|
|
|
|
|
0
|
return $assertion; |
180
|
|
|
|
|
|
|
} |
181
|
|
|
|
|
|
|
|
182
|
|
|
|
|
|
|
sub epoch { |
183
|
407
|
|
|
407
|
1
|
791
|
my ($self) = @_; |
184
|
|
|
|
|
|
|
|
185
|
407
|
|
|
|
|
942
|
return $self->timepiece->epoch; |
186
|
|
|
|
|
|
|
} |
187
|
|
|
|
|
|
|
|
188
|
|
|
|
|
|
|
sub explain { |
189
|
13
|
|
|
13
|
1
|
37
|
my ($self) = @_; |
190
|
|
|
|
|
|
|
|
191
|
13
|
|
|
|
|
55
|
return $self->epoch; |
192
|
|
|
|
|
|
|
} |
193
|
|
|
|
|
|
|
|
194
|
|
|
|
|
|
|
sub format { |
195
|
4
|
|
|
4
|
1
|
13
|
my ($self, @args) = @_; |
196
|
|
|
|
|
|
|
|
197
|
4
|
|
|
|
|
15
|
return $self->timepiece->strftime(@args); |
198
|
|
|
|
|
|
|
} |
199
|
|
|
|
|
|
|
|
200
|
|
|
|
|
|
|
sub hms { |
201
|
1
|
|
|
1
|
1
|
3
|
my ($self) = @_; |
202
|
|
|
|
|
|
|
|
203
|
1
|
|
|
|
|
5
|
return $self->timepiece->hms; |
204
|
|
|
|
|
|
|
} |
205
|
|
|
|
|
|
|
|
206
|
|
|
|
|
|
|
sub iso8601 { |
207
|
7
|
|
|
7
|
1
|
19
|
my ($self) = @_; |
208
|
|
|
|
|
|
|
|
209
|
7
|
|
|
|
|
24
|
return $self->timepiece->datetime; |
210
|
|
|
|
|
|
|
} |
211
|
|
|
|
|
|
|
|
212
|
|
|
|
|
|
|
sub mdy { |
213
|
1
|
|
|
1
|
1
|
4
|
my ($self) = @_; |
214
|
|
|
|
|
|
|
|
215
|
1
|
|
|
|
|
4
|
return $self->timepiece->mdy; |
216
|
|
|
|
|
|
|
} |
217
|
|
|
|
|
|
|
|
218
|
|
|
|
|
|
|
sub parse { |
219
|
1
|
|
|
1
|
1
|
5
|
my ($self, @args) = @_; |
220
|
|
|
|
|
|
|
|
221
|
1
|
|
|
|
|
5
|
my $timepiece = $self->timepiece->strptime(@args); |
222
|
|
|
|
|
|
|
|
223
|
1
|
|
|
|
|
195
|
return $self->reset($timepiece->epoch); |
224
|
|
|
|
|
|
|
} |
225
|
|
|
|
|
|
|
|
226
|
|
|
|
|
|
|
sub reset { |
227
|
134
|
|
|
134
|
1
|
14089
|
my ($self, $time) = @_; |
228
|
|
|
|
|
|
|
|
229
|
134
|
|
33
|
|
|
353
|
$time ||= time; |
230
|
|
|
|
|
|
|
|
231
|
134
|
|
|
|
|
425
|
my @time = gmtime $time; |
232
|
|
|
|
|
|
|
|
233
|
134
|
|
|
|
|
487
|
$self->day($time[3]); |
234
|
134
|
|
|
|
|
426
|
$self->hour($time[2]); |
235
|
134
|
|
|
|
|
407
|
$self->minute($time[1]); |
236
|
134
|
|
|
|
|
493
|
$self->month($time[4] + 1); |
237
|
134
|
|
|
|
|
421
|
$self->second($time[0]); |
238
|
134
|
|
|
|
|
490
|
$self->year($time[5] + 1900); |
239
|
|
|
|
|
|
|
|
240
|
134
|
|
|
|
|
945
|
return $self; |
241
|
|
|
|
|
|
|
} |
242
|
|
|
|
|
|
|
|
243
|
|
|
|
|
|
|
sub restart { |
244
|
0
|
|
|
0
|
1
|
0
|
my ($self, $here) = @_; |
245
|
|
|
|
|
|
|
|
246
|
0
|
|
|
|
|
0
|
my $timepiece = $self->timepiece->truncate(to => $here); |
247
|
|
|
|
|
|
|
|
248
|
0
|
|
|
|
|
0
|
return $self->reset($timepiece->epoch); |
249
|
|
|
|
|
|
|
} |
250
|
|
|
|
|
|
|
|
251
|
|
|
|
|
|
|
sub restart_day { |
252
|
0
|
|
|
0
|
1
|
0
|
my ($self) = @_; |
253
|
|
|
|
|
|
|
|
254
|
0
|
|
|
|
|
0
|
return $self->restart('day'); |
255
|
|
|
|
|
|
|
} |
256
|
|
|
|
|
|
|
|
257
|
|
|
|
|
|
|
sub restart_hour { |
258
|
0
|
|
|
0
|
1
|
0
|
my ($self) = @_; |
259
|
|
|
|
|
|
|
|
260
|
0
|
|
|
|
|
0
|
return $self->restart('hour'); |
261
|
|
|
|
|
|
|
} |
262
|
|
|
|
|
|
|
|
263
|
|
|
|
|
|
|
sub restart_minute { |
264
|
0
|
|
|
0
|
1
|
0
|
my ($self) = @_; |
265
|
|
|
|
|
|
|
|
266
|
0
|
|
|
|
|
0
|
return $self->restart('minute'); |
267
|
|
|
|
|
|
|
} |
268
|
|
|
|
|
|
|
|
269
|
|
|
|
|
|
|
sub restart_month { |
270
|
0
|
|
|
0
|
1
|
0
|
my ($self) = @_; |
271
|
|
|
|
|
|
|
|
272
|
0
|
|
|
|
|
0
|
return $self->restart('month'); |
273
|
|
|
|
|
|
|
} |
274
|
|
|
|
|
|
|
|
275
|
|
|
|
|
|
|
sub restart_quarter { |
276
|
0
|
|
|
0
|
1
|
0
|
my ($self) = @_; |
277
|
|
|
|
|
|
|
|
278
|
0
|
|
|
|
|
0
|
return $self->restart('quarter'); |
279
|
|
|
|
|
|
|
} |
280
|
|
|
|
|
|
|
|
281
|
|
|
|
|
|
|
sub restart_second { |
282
|
0
|
|
|
0
|
1
|
0
|
my ($self) = @_; |
283
|
|
|
|
|
|
|
|
284
|
0
|
|
|
|
|
0
|
return $self->restart('second'); |
285
|
|
|
|
|
|
|
} |
286
|
|
|
|
|
|
|
|
287
|
|
|
|
|
|
|
sub restart_year { |
288
|
0
|
|
|
0
|
1
|
0
|
my ($self) = @_; |
289
|
|
|
|
|
|
|
|
290
|
0
|
|
|
|
|
0
|
return $self->restart('year'); |
291
|
|
|
|
|
|
|
} |
292
|
|
|
|
|
|
|
|
293
|
|
|
|
|
|
|
sub rfc822 { |
294
|
1
|
|
|
1
|
1
|
3
|
my ($self) = @_; |
295
|
|
|
|
|
|
|
|
296
|
1
|
|
|
|
|
4
|
return $self->format('%a, %d %b %Y %H:%M:%S %z'); |
297
|
|
|
|
|
|
|
} |
298
|
|
|
|
|
|
|
|
299
|
|
|
|
|
|
|
sub rfc1123 { |
300
|
1
|
|
|
1
|
1
|
4
|
my ($self) = @_; |
301
|
|
|
|
|
|
|
|
302
|
1
|
|
|
|
|
6
|
return $self->format('%a, %d %b %Y %T GMT'); |
303
|
|
|
|
|
|
|
} |
304
|
|
|
|
|
|
|
|
305
|
|
|
|
|
|
|
sub rfc3339 { |
306
|
6
|
|
|
6
|
1
|
16
|
my ($self) = @_; |
307
|
|
|
|
|
|
|
|
308
|
6
|
|
|
|
|
12
|
return "@{[$self->iso8601]}Z"; |
|
6
|
|
|
|
|
26
|
|
309
|
|
|
|
|
|
|
} |
310
|
|
|
|
|
|
|
|
311
|
|
|
|
|
|
|
sub rfc7231 { |
312
|
1
|
|
|
1
|
1
|
3
|
my ($self) = @_; |
313
|
|
|
|
|
|
|
|
314
|
1
|
|
|
|
|
6
|
return $self->timepiece->strftime; |
315
|
|
|
|
|
|
|
} |
316
|
|
|
|
|
|
|
|
317
|
|
|
|
|
|
|
sub set { |
318
|
9
|
|
|
9
|
1
|
27
|
my ($self, $data) = @_; |
319
|
|
|
|
|
|
|
|
320
|
9
|
|
|
|
|
23
|
for my $name (qw(day hour minute month second year)) { |
321
|
54
|
100
|
|
|
|
118
|
if (defined $data->{$name}) { |
322
|
22
|
|
|
|
|
68
|
$self->$name($data->{$name}); |
323
|
|
|
|
|
|
|
} |
324
|
|
|
|
|
|
|
} |
325
|
|
|
|
|
|
|
|
326
|
9
|
|
|
|
|
117
|
return $self; |
327
|
|
|
|
|
|
|
} |
328
|
|
|
|
|
|
|
|
329
|
|
|
|
|
|
|
sub set_hms { |
330
|
3
|
|
|
3
|
1
|
9
|
my ($self, $h, $m, $s) = @_; |
331
|
|
|
|
|
|
|
|
332
|
3
|
|
|
|
|
5
|
my $data = {}; |
333
|
|
|
|
|
|
|
|
334
|
3
|
100
|
|
|
|
22
|
$data->{hour} = $h if defined $h; |
335
|
3
|
50
|
|
|
|
10
|
$data->{minute} = $m if defined $m; |
336
|
3
|
50
|
|
|
|
10
|
$data->{second} = $s if defined $s; |
337
|
|
|
|
|
|
|
|
338
|
3
|
|
|
|
|
9
|
return $self->set($data); |
339
|
|
|
|
|
|
|
} |
340
|
|
|
|
|
|
|
|
341
|
|
|
|
|
|
|
sub set_mdy { |
342
|
3
|
|
|
3
|
1
|
10
|
my ($self, $m, $d, $y) = @_; |
343
|
|
|
|
|
|
|
|
344
|
3
|
|
|
|
|
6
|
my $data = {}; |
345
|
|
|
|
|
|
|
|
346
|
3
|
50
|
|
|
|
12
|
$data->{day} = $d if defined $d; |
347
|
3
|
100
|
|
|
|
9
|
$data->{month} = $m if defined $m; |
348
|
3
|
100
|
|
|
|
9
|
$data->{year} = $y if defined $y; |
349
|
|
|
|
|
|
|
|
350
|
3
|
|
|
|
|
11
|
return $self->set($data); |
351
|
|
|
|
|
|
|
} |
352
|
|
|
|
|
|
|
|
353
|
|
|
|
|
|
|
sub string { |
354
|
5
|
|
|
5
|
1
|
777
|
my ($self) = @_; |
355
|
|
|
|
|
|
|
|
356
|
5
|
|
|
|
|
21
|
return $self->rfc3339; |
357
|
|
|
|
|
|
|
} |
358
|
|
|
|
|
|
|
|
359
|
|
|
|
|
|
|
sub sub { |
360
|
8
|
|
|
8
|
1
|
23
|
my ($self, $data) = @_; |
361
|
|
|
|
|
|
|
|
362
|
8
|
|
|
|
|
32
|
for my $name (qw(days hours minutes months seconds years)) { |
363
|
48
|
50
|
|
|
|
273
|
if (my $code = $self->can("sub_$name")) { |
364
|
48
|
|
|
|
|
225
|
$self->$code($data->{$name}); |
365
|
|
|
|
|
|
|
} |
366
|
|
|
|
|
|
|
} |
367
|
|
|
|
|
|
|
|
368
|
8
|
|
|
|
|
111
|
return $self; |
369
|
|
|
|
|
|
|
} |
370
|
|
|
|
|
|
|
|
371
|
|
|
|
|
|
|
sub sub_days { |
372
|
11
|
|
|
11
|
1
|
31
|
my ($self, $size) = @_; |
373
|
|
|
|
|
|
|
|
374
|
11
|
|
100
|
|
|
48
|
$size //= 0; |
375
|
|
|
|
|
|
|
|
376
|
11
|
100
|
|
|
|
54
|
$size = ($self->timeseconds->ONE_DAY * $size) if $size; |
377
|
|
|
|
|
|
|
|
378
|
11
|
|
|
|
|
127
|
return $self->reset($self->epoch - $size); |
379
|
|
|
|
|
|
|
} |
380
|
|
|
|
|
|
|
|
381
|
|
|
|
|
|
|
sub sub_hours { |
382
|
11
|
|
|
11
|
1
|
52
|
my ($self, $size) = @_; |
383
|
|
|
|
|
|
|
|
384
|
11
|
|
100
|
|
|
60
|
$size //= 0; |
385
|
|
|
|
|
|
|
|
386
|
11
|
100
|
|
|
|
44
|
$size = ($self->timeseconds->ONE_HOUR * $size) if $size; |
387
|
|
|
|
|
|
|
|
388
|
11
|
|
|
|
|
95
|
return $self->reset($self->epoch - $size); |
389
|
|
|
|
|
|
|
} |
390
|
|
|
|
|
|
|
|
391
|
|
|
|
|
|
|
sub sub_hms { |
392
|
3
|
|
|
3
|
1
|
10
|
my ($self, $h, $m, $s) = @_; |
393
|
|
|
|
|
|
|
|
394
|
3
|
|
|
|
|
8
|
my $data = {}; |
395
|
|
|
|
|
|
|
|
396
|
3
|
100
|
|
|
|
14
|
$data->{hours} = $h if defined $h; |
397
|
3
|
50
|
|
|
|
13
|
$data->{minutes} = $m if defined $m; |
398
|
3
|
100
|
|
|
|
14
|
$data->{seconds} = $s if defined $s; |
399
|
|
|
|
|
|
|
|
400
|
3
|
|
|
|
|
12
|
return $self->sub($data); |
401
|
|
|
|
|
|
|
} |
402
|
|
|
|
|
|
|
|
403
|
|
|
|
|
|
|
sub sub_mdy { |
404
|
3
|
|
|
3
|
1
|
19
|
my ($self, $m, $d, $y) = @_; |
405
|
|
|
|
|
|
|
|
406
|
3
|
|
|
|
|
6
|
my $data = {}; |
407
|
|
|
|
|
|
|
|
408
|
3
|
50
|
|
|
|
15
|
$data->{days} = $d if defined $d; |
409
|
3
|
50
|
|
|
|
11
|
$data->{months} = $m if defined $m; |
410
|
3
|
100
|
|
|
|
10
|
$data->{years} = $y if defined $y; |
411
|
|
|
|
|
|
|
|
412
|
3
|
|
|
|
|
13
|
return $self->sub($data); |
413
|
|
|
|
|
|
|
} |
414
|
|
|
|
|
|
|
|
415
|
|
|
|
|
|
|
sub sub_minutes { |
416
|
11
|
|
|
11
|
1
|
68
|
my ($self, $size) = @_; |
417
|
|
|
|
|
|
|
|
418
|
11
|
|
100
|
|
|
40
|
$size //= 0; |
419
|
|
|
|
|
|
|
|
420
|
11
|
100
|
|
|
|
43
|
$size = ($self->timeseconds->ONE_MINUTE * $size) if $size; |
421
|
|
|
|
|
|
|
|
422
|
11
|
|
|
|
|
107
|
return $self->reset($self->epoch - $size); |
423
|
|
|
|
|
|
|
} |
424
|
|
|
|
|
|
|
|
425
|
|
|
|
|
|
|
sub sub_months { |
426
|
11
|
|
|
11
|
1
|
41
|
my ($self, $size) = @_; |
427
|
|
|
|
|
|
|
|
428
|
11
|
|
100
|
|
|
56
|
$size //= 0; |
429
|
|
|
|
|
|
|
|
430
|
11
|
100
|
|
|
|
47
|
$size = ($self->timeseconds->ONE_MONTH * $size) if $size; |
431
|
|
|
|
|
|
|
|
432
|
11
|
|
|
|
|
116
|
return $self->reset($self->epoch - $size); |
433
|
|
|
|
|
|
|
} |
434
|
|
|
|
|
|
|
|
435
|
|
|
|
|
|
|
sub sub_seconds { |
436
|
11
|
|
|
11
|
1
|
42
|
my ($self, $size) = @_; |
437
|
|
|
|
|
|
|
|
438
|
11
|
|
100
|
|
|
42
|
$size //= 0; |
439
|
|
|
|
|
|
|
|
440
|
11
|
|
|
|
|
28
|
return $self->reset($self->epoch - $size); |
441
|
|
|
|
|
|
|
} |
442
|
|
|
|
|
|
|
|
443
|
|
|
|
|
|
|
sub sub_years { |
444
|
11
|
|
|
11
|
1
|
47
|
my ($self, $size) = @_; |
445
|
|
|
|
|
|
|
|
446
|
11
|
|
100
|
|
|
49
|
$size //= 0; |
447
|
|
|
|
|
|
|
|
448
|
11
|
100
|
|
|
|
41
|
$size = ($self->timeseconds->ONE_YEAR * $size) if $size; |
449
|
|
|
|
|
|
|
|
450
|
11
|
|
|
|
|
86
|
return $self->reset($self->epoch - $size); |
451
|
|
|
|
|
|
|
} |
452
|
|
|
|
|
|
|
|
453
|
|
|
|
|
|
|
sub timelocal { |
454
|
422
|
|
|
422
|
0
|
756
|
my ($self) = @_; |
455
|
|
|
|
|
|
|
|
456
|
422
|
|
|
|
|
1146
|
require Time::Local; |
457
|
|
|
|
|
|
|
|
458
|
422
|
|
|
|
|
1138
|
my $day = $self->day; |
459
|
422
|
|
|
|
|
1131
|
my $hour = $self->hour; |
460
|
422
|
|
|
|
|
929
|
my $minute = $self->minute; |
461
|
422
|
|
|
|
|
962
|
my $month = $self->month - 1; |
462
|
422
|
|
|
|
|
1054
|
my $second = $self->second; |
463
|
422
|
|
|
|
|
1025
|
my $year = $self->year; |
464
|
|
|
|
|
|
|
|
465
|
422
|
|
|
|
|
1341
|
return Time::Local::timegm($second, $minute, $hour, $day, $month, $year); |
466
|
|
|
|
|
|
|
} |
467
|
|
|
|
|
|
|
|
468
|
|
|
|
|
|
|
sub timepiece { |
469
|
422
|
|
|
422
|
0
|
812
|
my ($self) = @_; |
470
|
|
|
|
|
|
|
|
471
|
422
|
|
|
|
|
3211
|
require Time::Piece; |
472
|
|
|
|
|
|
|
|
473
|
422
|
|
|
|
|
23154
|
return Time::Piece->gmtime(0 + $self->timelocal); |
474
|
|
|
|
|
|
|
} |
475
|
|
|
|
|
|
|
|
476
|
|
|
|
|
|
|
sub timeseconds { |
477
|
60
|
|
|
60
|
0
|
151
|
my ($self, $time) = @_; |
478
|
|
|
|
|
|
|
|
479
|
60
|
|
|
|
|
391
|
require Time::Seconds; |
480
|
|
|
|
|
|
|
|
481
|
60
|
|
50
|
|
|
519
|
return Time::Seconds->new($time // 0); |
482
|
|
|
|
|
|
|
} |
483
|
|
|
|
|
|
|
|
484
|
|
|
|
|
|
|
1; |
485
|
|
|
|
|
|
|
|
486
|
|
|
|
|
|
|
|
487
|
|
|
|
|
|
|
|
488
|
|
|
|
|
|
|
=head1 NAME |
489
|
|
|
|
|
|
|
|
490
|
|
|
|
|
|
|
Venus::Date - Date Class |
491
|
|
|
|
|
|
|
|
492
|
|
|
|
|
|
|
=cut |
493
|
|
|
|
|
|
|
|
494
|
|
|
|
|
|
|
=head1 ABSTRACT |
495
|
|
|
|
|
|
|
|
496
|
|
|
|
|
|
|
Date Class for Perl 5 |
497
|
|
|
|
|
|
|
|
498
|
|
|
|
|
|
|
=cut |
499
|
|
|
|
|
|
|
|
500
|
|
|
|
|
|
|
=head1 SYNOPSIS |
501
|
|
|
|
|
|
|
|
502
|
|
|
|
|
|
|
package main; |
503
|
|
|
|
|
|
|
|
504
|
|
|
|
|
|
|
use Venus::Date; |
505
|
|
|
|
|
|
|
|
506
|
|
|
|
|
|
|
my $date = Venus::Date->new(570672000); |
507
|
|
|
|
|
|
|
|
508
|
|
|
|
|
|
|
# $date->string; |
509
|
|
|
|
|
|
|
|
510
|
|
|
|
|
|
|
# '1988-02-01T00:00:00Z' |
511
|
|
|
|
|
|
|
|
512
|
|
|
|
|
|
|
=cut |
513
|
|
|
|
|
|
|
|
514
|
|
|
|
|
|
|
=head1 DESCRIPTION |
515
|
|
|
|
|
|
|
|
516
|
|
|
|
|
|
|
This package provides methods for formatting, parsing, and manipulating date |
517
|
|
|
|
|
|
|
and time data. |
518
|
|
|
|
|
|
|
|
519
|
|
|
|
|
|
|
=cut |
520
|
|
|
|
|
|
|
|
521
|
|
|
|
|
|
|
=head1 ATTRIBUTES |
522
|
|
|
|
|
|
|
|
523
|
|
|
|
|
|
|
This package has the following attributes: |
524
|
|
|
|
|
|
|
|
525
|
|
|
|
|
|
|
=cut |
526
|
|
|
|
|
|
|
|
527
|
|
|
|
|
|
|
=head2 day |
528
|
|
|
|
|
|
|
|
529
|
|
|
|
|
|
|
day(Int) |
530
|
|
|
|
|
|
|
|
531
|
|
|
|
|
|
|
This attribute is read-write, accepts C<(Int)> values, and is optional. |
532
|
|
|
|
|
|
|
|
533
|
|
|
|
|
|
|
=cut |
534
|
|
|
|
|
|
|
|
535
|
|
|
|
|
|
|
=head2 month |
536
|
|
|
|
|
|
|
|
537
|
|
|
|
|
|
|
month(Int) |
538
|
|
|
|
|
|
|
|
539
|
|
|
|
|
|
|
This attribute is read-write, accepts C<(Int)> values, and is optional. |
540
|
|
|
|
|
|
|
|
541
|
|
|
|
|
|
|
=cut |
542
|
|
|
|
|
|
|
|
543
|
|
|
|
|
|
|
=head2 year |
544
|
|
|
|
|
|
|
|
545
|
|
|
|
|
|
|
year(Int) |
546
|
|
|
|
|
|
|
|
547
|
|
|
|
|
|
|
This attribute is read-write, accepts C<(Int)> values, and is optional. |
548
|
|
|
|
|
|
|
|
549
|
|
|
|
|
|
|
=cut |
550
|
|
|
|
|
|
|
|
551
|
|
|
|
|
|
|
=head2 hour |
552
|
|
|
|
|
|
|
|
553
|
|
|
|
|
|
|
hour(Int) |
554
|
|
|
|
|
|
|
|
555
|
|
|
|
|
|
|
This attribute is read-write, accepts C<(Int)> values, and is optional. |
556
|
|
|
|
|
|
|
|
557
|
|
|
|
|
|
|
=cut |
558
|
|
|
|
|
|
|
|
559
|
|
|
|
|
|
|
=head2 minute |
560
|
|
|
|
|
|
|
|
561
|
|
|
|
|
|
|
minute(Int) |
562
|
|
|
|
|
|
|
|
563
|
|
|
|
|
|
|
This attribute is read-write, accepts C<(Int)> values, and is optional. |
564
|
|
|
|
|
|
|
|
565
|
|
|
|
|
|
|
=cut |
566
|
|
|
|
|
|
|
|
567
|
|
|
|
|
|
|
=head2 second |
568
|
|
|
|
|
|
|
|
569
|
|
|
|
|
|
|
second(Int) |
570
|
|
|
|
|
|
|
|
571
|
|
|
|
|
|
|
This attribute is read-write, accepts C<(Int)> values, and is optional. |
572
|
|
|
|
|
|
|
|
573
|
|
|
|
|
|
|
=cut |
574
|
|
|
|
|
|
|
|
575
|
|
|
|
|
|
|
=head1 INHERITS |
576
|
|
|
|
|
|
|
|
577
|
|
|
|
|
|
|
This package inherits behaviors from: |
578
|
|
|
|
|
|
|
|
579
|
|
|
|
|
|
|
L |
580
|
|
|
|
|
|
|
|
581
|
|
|
|
|
|
|
=cut |
582
|
|
|
|
|
|
|
|
583
|
|
|
|
|
|
|
=head1 INTEGRATES |
584
|
|
|
|
|
|
|
|
585
|
|
|
|
|
|
|
This package integrates behaviors from: |
586
|
|
|
|
|
|
|
|
587
|
|
|
|
|
|
|
L |
588
|
|
|
|
|
|
|
|
589
|
|
|
|
|
|
|
L |
590
|
|
|
|
|
|
|
|
591
|
|
|
|
|
|
|
=cut |
592
|
|
|
|
|
|
|
|
593
|
|
|
|
|
|
|
=head1 METHODS |
594
|
|
|
|
|
|
|
|
595
|
|
|
|
|
|
|
This package provides the following methods: |
596
|
|
|
|
|
|
|
|
597
|
|
|
|
|
|
|
=cut |
598
|
|
|
|
|
|
|
|
599
|
|
|
|
|
|
|
=head2 add |
600
|
|
|
|
|
|
|
|
601
|
|
|
|
|
|
|
add(hashref $data) (Venus::Date) |
602
|
|
|
|
|
|
|
|
603
|
|
|
|
|
|
|
The add method increments the date and time attributes specified. |
604
|
|
|
|
|
|
|
|
605
|
|
|
|
|
|
|
I> |
606
|
|
|
|
|
|
|
|
607
|
|
|
|
|
|
|
=over 4 |
608
|
|
|
|
|
|
|
|
609
|
|
|
|
|
|
|
=item add example 1 |
610
|
|
|
|
|
|
|
|
611
|
|
|
|
|
|
|
# given: synopsis; |
612
|
|
|
|
|
|
|
|
613
|
|
|
|
|
|
|
$date = $date->add({ |
614
|
|
|
|
|
|
|
days => 1, |
615
|
|
|
|
|
|
|
months => 1, |
616
|
|
|
|
|
|
|
years => 1, |
617
|
|
|
|
|
|
|
}); |
618
|
|
|
|
|
|
|
|
619
|
|
|
|
|
|
|
# $date->string; # 1989-03-03T16:17:54Z |
620
|
|
|
|
|
|
|
|
621
|
|
|
|
|
|
|
# $date->epoch; # 604945074 |
622
|
|
|
|
|
|
|
|
623
|
|
|
|
|
|
|
|
624
|
|
|
|
|
|
|
|
625
|
|
|
|
|
|
|
|
626
|
|
|
|
|
|
|
=back |
627
|
|
|
|
|
|
|
|
628
|
|
|
|
|
|
|
=over 4 |
629
|
|
|
|
|
|
|
|
630
|
|
|
|
|
|
|
=item add example 2 |
631
|
|
|
|
|
|
|
|
632
|
|
|
|
|
|
|
# given: synopsis; |
633
|
|
|
|
|
|
|
|
634
|
|
|
|
|
|
|
$date = $date->add({ |
635
|
|
|
|
|
|
|
hours => 1, |
636
|
|
|
|
|
|
|
minutes => 1, |
637
|
|
|
|
|
|
|
seconds => 1, |
638
|
|
|
|
|
|
|
}); |
639
|
|
|
|
|
|
|
|
640
|
|
|
|
|
|
|
# $date->string; # 1988-02-01T01:01:01Z |
641
|
|
|
|
|
|
|
|
642
|
|
|
|
|
|
|
# $date->epoch; # 570675661 |
643
|
|
|
|
|
|
|
|
644
|
|
|
|
|
|
|
=back |
645
|
|
|
|
|
|
|
|
646
|
|
|
|
|
|
|
=cut |
647
|
|
|
|
|
|
|
|
648
|
|
|
|
|
|
|
=head2 add_days |
649
|
|
|
|
|
|
|
|
650
|
|
|
|
|
|
|
add_days(number $days) (any) |
651
|
|
|
|
|
|
|
|
652
|
|
|
|
|
|
|
The add_days method increments the C attribute. |
653
|
|
|
|
|
|
|
|
654
|
|
|
|
|
|
|
I> |
655
|
|
|
|
|
|
|
|
656
|
|
|
|
|
|
|
=over 4 |
657
|
|
|
|
|
|
|
|
658
|
|
|
|
|
|
|
=item add_days example 1 |
659
|
|
|
|
|
|
|
|
660
|
|
|
|
|
|
|
# given: synopsis; |
661
|
|
|
|
|
|
|
|
662
|
|
|
|
|
|
|
$date = $date->add_days(1); |
663
|
|
|
|
|
|
|
|
664
|
|
|
|
|
|
|
# $date->string; # 1988-02-02T00:00:00Z |
665
|
|
|
|
|
|
|
|
666
|
|
|
|
|
|
|
# $date->epoch; # 570758400 |
667
|
|
|
|
|
|
|
|
668
|
|
|
|
|
|
|
=back |
669
|
|
|
|
|
|
|
|
670
|
|
|
|
|
|
|
=over 4 |
671
|
|
|
|
|
|
|
|
672
|
|
|
|
|
|
|
=item add_days example 2 |
673
|
|
|
|
|
|
|
|
674
|
|
|
|
|
|
|
# given: synopsis; |
675
|
|
|
|
|
|
|
|
676
|
|
|
|
|
|
|
$date = $date->add_days(40); |
677
|
|
|
|
|
|
|
|
678
|
|
|
|
|
|
|
# $date->string; # 1988-03-12T00:00:00Z |
679
|
|
|
|
|
|
|
|
680
|
|
|
|
|
|
|
# $date->epoch; # 574128000 |
681
|
|
|
|
|
|
|
|
682
|
|
|
|
|
|
|
=back |
683
|
|
|
|
|
|
|
|
684
|
|
|
|
|
|
|
=over 4 |
685
|
|
|
|
|
|
|
|
686
|
|
|
|
|
|
|
=item add_days example 3 |
687
|
|
|
|
|
|
|
|
688
|
|
|
|
|
|
|
# given: synopsis; |
689
|
|
|
|
|
|
|
|
690
|
|
|
|
|
|
|
$date = $date->add_days(-1); |
691
|
|
|
|
|
|
|
|
692
|
|
|
|
|
|
|
# $date->string; # 1988-01-31T00:00:00Z |
693
|
|
|
|
|
|
|
|
694
|
|
|
|
|
|
|
# $date->epoch; # 570585600 |
695
|
|
|
|
|
|
|
|
696
|
|
|
|
|
|
|
=back |
697
|
|
|
|
|
|
|
|
698
|
|
|
|
|
|
|
=cut |
699
|
|
|
|
|
|
|
|
700
|
|
|
|
|
|
|
=head2 add_hms |
701
|
|
|
|
|
|
|
|
702
|
|
|
|
|
|
|
add_hms(maybe[number] $hours, maybe[number] $minutes, maybe[number] $seconds) (Venus::Date) |
703
|
|
|
|
|
|
|
|
704
|
|
|
|
|
|
|
The add_hms method increments the C, C, and C attributes. |
705
|
|
|
|
|
|
|
|
706
|
|
|
|
|
|
|
I> |
707
|
|
|
|
|
|
|
|
708
|
|
|
|
|
|
|
=over 4 |
709
|
|
|
|
|
|
|
|
710
|
|
|
|
|
|
|
=item add_hms example 1 |
711
|
|
|
|
|
|
|
|
712
|
|
|
|
|
|
|
# given: synopsis; |
713
|
|
|
|
|
|
|
|
714
|
|
|
|
|
|
|
$date = $date->add_hms(1, 0, 0); |
715
|
|
|
|
|
|
|
|
716
|
|
|
|
|
|
|
# $date->string; # 1988-02-01T01:00:00Z |
717
|
|
|
|
|
|
|
|
718
|
|
|
|
|
|
|
# $date->epoch; # 570675600 |
719
|
|
|
|
|
|
|
|
720
|
|
|
|
|
|
|
=back |
721
|
|
|
|
|
|
|
|
722
|
|
|
|
|
|
|
=over 4 |
723
|
|
|
|
|
|
|
|
724
|
|
|
|
|
|
|
=item add_hms example 2 |
725
|
|
|
|
|
|
|
|
726
|
|
|
|
|
|
|
# given: synopsis; |
727
|
|
|
|
|
|
|
|
728
|
|
|
|
|
|
|
$date = $date->add_hms(undef, 1, 1); |
729
|
|
|
|
|
|
|
|
730
|
|
|
|
|
|
|
# $date->string; # 1988-02-01T00:01:01Z |
731
|
|
|
|
|
|
|
|
732
|
|
|
|
|
|
|
# $date->epoch; # 570672061 |
733
|
|
|
|
|
|
|
|
734
|
|
|
|
|
|
|
=back |
735
|
|
|
|
|
|
|
|
736
|
|
|
|
|
|
|
=over 4 |
737
|
|
|
|
|
|
|
|
738
|
|
|
|
|
|
|
=item add_hms example 3 |
739
|
|
|
|
|
|
|
|
740
|
|
|
|
|
|
|
# given: synopsis; |
741
|
|
|
|
|
|
|
|
742
|
|
|
|
|
|
|
$date = $date->add_hms(1, 1); |
743
|
|
|
|
|
|
|
|
744
|
|
|
|
|
|
|
# $date->string; # 1988-02-01T01:01:00Z |
745
|
|
|
|
|
|
|
|
746
|
|
|
|
|
|
|
# $date->epoch; # 570675660 |
747
|
|
|
|
|
|
|
|
748
|
|
|
|
|
|
|
=back |
749
|
|
|
|
|
|
|
|
750
|
|
|
|
|
|
|
=cut |
751
|
|
|
|
|
|
|
|
752
|
|
|
|
|
|
|
=head2 add_hours |
753
|
|
|
|
|
|
|
|
754
|
|
|
|
|
|
|
add_hours(number $hours) (any) |
755
|
|
|
|
|
|
|
|
756
|
|
|
|
|
|
|
The add_hours method increments the C attribute. |
757
|
|
|
|
|
|
|
|
758
|
|
|
|
|
|
|
I> |
759
|
|
|
|
|
|
|
|
760
|
|
|
|
|
|
|
=over 4 |
761
|
|
|
|
|
|
|
|
762
|
|
|
|
|
|
|
=item add_hours example 1 |
763
|
|
|
|
|
|
|
|
764
|
|
|
|
|
|
|
# given: synopsis; |
765
|
|
|
|
|
|
|
|
766
|
|
|
|
|
|
|
$date = $date->add_hours(1); |
767
|
|
|
|
|
|
|
|
768
|
|
|
|
|
|
|
# $date->string; # 1988-02-01T01:00:00Z |
769
|
|
|
|
|
|
|
|
770
|
|
|
|
|
|
|
# $date->epoch; # 570675600 |
771
|
|
|
|
|
|
|
|
772
|
|
|
|
|
|
|
=back |
773
|
|
|
|
|
|
|
|
774
|
|
|
|
|
|
|
=over 4 |
775
|
|
|
|
|
|
|
|
776
|
|
|
|
|
|
|
=item add_hours example 2 |
777
|
|
|
|
|
|
|
|
778
|
|
|
|
|
|
|
# given: synopsis; |
779
|
|
|
|
|
|
|
|
780
|
|
|
|
|
|
|
$date = $date->add_hours(25); |
781
|
|
|
|
|
|
|
|
782
|
|
|
|
|
|
|
# $date->string; # 1988-02-02T01:00:00Z |
783
|
|
|
|
|
|
|
|
784
|
|
|
|
|
|
|
# $date->epoch; # 570762000 |
785
|
|
|
|
|
|
|
|
786
|
|
|
|
|
|
|
=back |
787
|
|
|
|
|
|
|
|
788
|
|
|
|
|
|
|
=over 4 |
789
|
|
|
|
|
|
|
|
790
|
|
|
|
|
|
|
=item add_hours example 3 |
791
|
|
|
|
|
|
|
|
792
|
|
|
|
|
|
|
# given: synopsis; |
793
|
|
|
|
|
|
|
|
794
|
|
|
|
|
|
|
$date = $date->add_hours(-1); |
795
|
|
|
|
|
|
|
|
796
|
|
|
|
|
|
|
# $date->string; # 1988-01-31T23:00:00Z |
797
|
|
|
|
|
|
|
|
798
|
|
|
|
|
|
|
# $date->epoch; # 570668400 |
799
|
|
|
|
|
|
|
|
800
|
|
|
|
|
|
|
=back |
801
|
|
|
|
|
|
|
|
802
|
|
|
|
|
|
|
=cut |
803
|
|
|
|
|
|
|
|
804
|
|
|
|
|
|
|
=head2 add_mdy |
805
|
|
|
|
|
|
|
|
806
|
|
|
|
|
|
|
add_mdy(maybe[number] $months, maybe[number] $days, maybe[number] $years) (Venus::Date) |
807
|
|
|
|
|
|
|
|
808
|
|
|
|
|
|
|
The add_mdy method increments the C, C, and C attributes. |
809
|
|
|
|
|
|
|
|
810
|
|
|
|
|
|
|
I> |
811
|
|
|
|
|
|
|
|
812
|
|
|
|
|
|
|
=over 4 |
813
|
|
|
|
|
|
|
|
814
|
|
|
|
|
|
|
=item add_mdy example 1 |
815
|
|
|
|
|
|
|
|
816
|
|
|
|
|
|
|
# given: synopsis; |
817
|
|
|
|
|
|
|
|
818
|
|
|
|
|
|
|
$date = $date->add_mdy(1, 0, 0); |
819
|
|
|
|
|
|
|
|
820
|
|
|
|
|
|
|
# $date->string; # 1988-03-02T10:29:04Z |
821
|
|
|
|
|
|
|
|
822
|
|
|
|
|
|
|
# $date->epoch; # 573301744 |
823
|
|
|
|
|
|
|
|
824
|
|
|
|
|
|
|
=back |
825
|
|
|
|
|
|
|
|
826
|
|
|
|
|
|
|
=over 4 |
827
|
|
|
|
|
|
|
|
828
|
|
|
|
|
|
|
=item add_mdy example 2 |
829
|
|
|
|
|
|
|
|
830
|
|
|
|
|
|
|
# given: synopsis; |
831
|
|
|
|
|
|
|
|
832
|
|
|
|
|
|
|
$date = $date->add_mdy(undef, 1, 1); |
833
|
|
|
|
|
|
|
|
834
|
|
|
|
|
|
|
# $date->string; # 1989-02-01T05:48:50Z |
835
|
|
|
|
|
|
|
|
836
|
|
|
|
|
|
|
# $date->epoch; # 602315330 |
837
|
|
|
|
|
|
|
|
838
|
|
|
|
|
|
|
=back |
839
|
|
|
|
|
|
|
|
840
|
|
|
|
|
|
|
=over 4 |
841
|
|
|
|
|
|
|
|
842
|
|
|
|
|
|
|
=item add_mdy example 3 |
843
|
|
|
|
|
|
|
|
844
|
|
|
|
|
|
|
# given: synopsis; |
845
|
|
|
|
|
|
|
|
846
|
|
|
|
|
|
|
$date = $date->add_mdy(1, 1); |
847
|
|
|
|
|
|
|
|
848
|
|
|
|
|
|
|
# $date->string; # 1988-03-03T10:29:04Z |
849
|
|
|
|
|
|
|
|
850
|
|
|
|
|
|
|
# $date->epoch; # 573388144 |
851
|
|
|
|
|
|
|
|
852
|
|
|
|
|
|
|
=back |
853
|
|
|
|
|
|
|
|
854
|
|
|
|
|
|
|
=cut |
855
|
|
|
|
|
|
|
|
856
|
|
|
|
|
|
|
=head2 add_minutes |
857
|
|
|
|
|
|
|
|
858
|
|
|
|
|
|
|
add_minutes(number $minutes) (Venus::Date) |
859
|
|
|
|
|
|
|
|
860
|
|
|
|
|
|
|
The add_minutes method increments the C attribute. |
861
|
|
|
|
|
|
|
|
862
|
|
|
|
|
|
|
I> |
863
|
|
|
|
|
|
|
|
864
|
|
|
|
|
|
|
=over 4 |
865
|
|
|
|
|
|
|
|
866
|
|
|
|
|
|
|
=item add_minutes example 1 |
867
|
|
|
|
|
|
|
|
868
|
|
|
|
|
|
|
# given: synopsis; |
869
|
|
|
|
|
|
|
|
870
|
|
|
|
|
|
|
$date = $date->add_minutes(1); |
871
|
|
|
|
|
|
|
|
872
|
|
|
|
|
|
|
# $date->string; # 1988-02-01T00:01:00Z |
873
|
|
|
|
|
|
|
|
874
|
|
|
|
|
|
|
# $date->epoch; # 570672060 |
875
|
|
|
|
|
|
|
|
876
|
|
|
|
|
|
|
=back |
877
|
|
|
|
|
|
|
|
878
|
|
|
|
|
|
|
=over 4 |
879
|
|
|
|
|
|
|
|
880
|
|
|
|
|
|
|
=item add_minutes example 2 |
881
|
|
|
|
|
|
|
|
882
|
|
|
|
|
|
|
# given: synopsis; |
883
|
|
|
|
|
|
|
|
884
|
|
|
|
|
|
|
$date = $date->add_minutes(61); |
885
|
|
|
|
|
|
|
|
886
|
|
|
|
|
|
|
# $date->string; # 1988-02-01T01:01:00Z |
887
|
|
|
|
|
|
|
|
888
|
|
|
|
|
|
|
# $date->epoch; # 570675660 |
889
|
|
|
|
|
|
|
|
890
|
|
|
|
|
|
|
=back |
891
|
|
|
|
|
|
|
|
892
|
|
|
|
|
|
|
=over 4 |
893
|
|
|
|
|
|
|
|
894
|
|
|
|
|
|
|
=item add_minutes example 3 |
895
|
|
|
|
|
|
|
|
896
|
|
|
|
|
|
|
# given: synopsis; |
897
|
|
|
|
|
|
|
|
898
|
|
|
|
|
|
|
$date = $date->add_minutes(-1); |
899
|
|
|
|
|
|
|
|
900
|
|
|
|
|
|
|
# $date->string; # 1988-01-31T23:59:00Z |
901
|
|
|
|
|
|
|
|
902
|
|
|
|
|
|
|
# $date->epoch; # 570671940 |
903
|
|
|
|
|
|
|
|
904
|
|
|
|
|
|
|
=back |
905
|
|
|
|
|
|
|
|
906
|
|
|
|
|
|
|
=cut |
907
|
|
|
|
|
|
|
|
908
|
|
|
|
|
|
|
=head2 add_months |
909
|
|
|
|
|
|
|
|
910
|
|
|
|
|
|
|
add_months(number $months) (Venus::Date) |
911
|
|
|
|
|
|
|
|
912
|
|
|
|
|
|
|
The add_months method increments the C attribute. |
913
|
|
|
|
|
|
|
|
914
|
|
|
|
|
|
|
I> |
915
|
|
|
|
|
|
|
|
916
|
|
|
|
|
|
|
=over 4 |
917
|
|
|
|
|
|
|
|
918
|
|
|
|
|
|
|
=item add_months example 1 |
919
|
|
|
|
|
|
|
|
920
|
|
|
|
|
|
|
# given: synopsis; |
921
|
|
|
|
|
|
|
|
922
|
|
|
|
|
|
|
$date = $date->add_months(1); |
923
|
|
|
|
|
|
|
|
924
|
|
|
|
|
|
|
# $date->string; # 1988-03-02T10:29:04Z |
925
|
|
|
|
|
|
|
|
926
|
|
|
|
|
|
|
# $date->epoch; # 573301744 |
927
|
|
|
|
|
|
|
|
928
|
|
|
|
|
|
|
=back |
929
|
|
|
|
|
|
|
|
930
|
|
|
|
|
|
|
=over 4 |
931
|
|
|
|
|
|
|
|
932
|
|
|
|
|
|
|
=item add_months example 2 |
933
|
|
|
|
|
|
|
|
934
|
|
|
|
|
|
|
# given: synopsis; |
935
|
|
|
|
|
|
|
|
936
|
|
|
|
|
|
|
$date = $date->add_months(13); |
937
|
|
|
|
|
|
|
|
938
|
|
|
|
|
|
|
# $date->string; # 1989-03-02T16:17:52Z |
939
|
|
|
|
|
|
|
|
940
|
|
|
|
|
|
|
# $date->epoch; # 604858672 |
941
|
|
|
|
|
|
|
|
942
|
|
|
|
|
|
|
=back |
943
|
|
|
|
|
|
|
|
944
|
|
|
|
|
|
|
=over 4 |
945
|
|
|
|
|
|
|
|
946
|
|
|
|
|
|
|
=item add_months example 3 |
947
|
|
|
|
|
|
|
|
948
|
|
|
|
|
|
|
# given: synopsis; |
949
|
|
|
|
|
|
|
|
950
|
|
|
|
|
|
|
$date = $date->add_months(-1); |
951
|
|
|
|
|
|
|
|
952
|
|
|
|
|
|
|
# $date->string; # 1988-01-01T13:30:56Z |
953
|
|
|
|
|
|
|
|
954
|
|
|
|
|
|
|
# $date->epoch; # 568042256 |
955
|
|
|
|
|
|
|
|
956
|
|
|
|
|
|
|
=back |
957
|
|
|
|
|
|
|
|
958
|
|
|
|
|
|
|
=cut |
959
|
|
|
|
|
|
|
|
960
|
|
|
|
|
|
|
=head2 add_seconds |
961
|
|
|
|
|
|
|
|
962
|
|
|
|
|
|
|
add_seconds(number $seconds) (Venus::Date) |
963
|
|
|
|
|
|
|
|
964
|
|
|
|
|
|
|
The add_seconds method increments the C attribute. |
965
|
|
|
|
|
|
|
|
966
|
|
|
|
|
|
|
I> |
967
|
|
|
|
|
|
|
|
968
|
|
|
|
|
|
|
=over 4 |
969
|
|
|
|
|
|
|
|
970
|
|
|
|
|
|
|
=item add_seconds example 1 |
971
|
|
|
|
|
|
|
|
972
|
|
|
|
|
|
|
# given: synopsis; |
973
|
|
|
|
|
|
|
|
974
|
|
|
|
|
|
|
$date = $date->add_seconds(1); |
975
|
|
|
|
|
|
|
|
976
|
|
|
|
|
|
|
# $date->string; # 1988-02-01T00:00:01Z |
977
|
|
|
|
|
|
|
|
978
|
|
|
|
|
|
|
# $date->epoch; # 570672001 |
979
|
|
|
|
|
|
|
|
980
|
|
|
|
|
|
|
=back |
981
|
|
|
|
|
|
|
|
982
|
|
|
|
|
|
|
=over 4 |
983
|
|
|
|
|
|
|
|
984
|
|
|
|
|
|
|
=item add_seconds example 2 |
985
|
|
|
|
|
|
|
|
986
|
|
|
|
|
|
|
# given: synopsis; |
987
|
|
|
|
|
|
|
|
988
|
|
|
|
|
|
|
$date = $date->add_seconds(61); |
989
|
|
|
|
|
|
|
|
990
|
|
|
|
|
|
|
# $date->string; # 1988-02-01T00:01:01Z |
991
|
|
|
|
|
|
|
|
992
|
|
|
|
|
|
|
# $date->epoch; # 570672061 |
993
|
|
|
|
|
|
|
|
994
|
|
|
|
|
|
|
=back |
995
|
|
|
|
|
|
|
|
996
|
|
|
|
|
|
|
=over 4 |
997
|
|
|
|
|
|
|
|
998
|
|
|
|
|
|
|
=item add_seconds example 3 |
999
|
|
|
|
|
|
|
|
1000
|
|
|
|
|
|
|
# given: synopsis; |
1001
|
|
|
|
|
|
|
|
1002
|
|
|
|
|
|
|
$date = $date->add_seconds(-1); |
1003
|
|
|
|
|
|
|
|
1004
|
|
|
|
|
|
|
# $date->string; # 1988-01-31T23:59:59Z |
1005
|
|
|
|
|
|
|
|
1006
|
|
|
|
|
|
|
# $date->epoch; # 570671999 |
1007
|
|
|
|
|
|
|
|
1008
|
|
|
|
|
|
|
=back |
1009
|
|
|
|
|
|
|
|
1010
|
|
|
|
|
|
|
=cut |
1011
|
|
|
|
|
|
|
|
1012
|
|
|
|
|
|
|
=head2 add_years |
1013
|
|
|
|
|
|
|
|
1014
|
|
|
|
|
|
|
add_years(number $years) (Venus::Date) |
1015
|
|
|
|
|
|
|
|
1016
|
|
|
|
|
|
|
The add_years method increments the C attribute. |
1017
|
|
|
|
|
|
|
|
1018
|
|
|
|
|
|
|
I> |
1019
|
|
|
|
|
|
|
|
1020
|
|
|
|
|
|
|
=over 4 |
1021
|
|
|
|
|
|
|
|
1022
|
|
|
|
|
|
|
=item add_years example 1 |
1023
|
|
|
|
|
|
|
|
1024
|
|
|
|
|
|
|
# given: synopsis; |
1025
|
|
|
|
|
|
|
|
1026
|
|
|
|
|
|
|
$date = $date->add_years(1); |
1027
|
|
|
|
|
|
|
|
1028
|
|
|
|
|
|
|
# $date->string; # 1989-01-31T05:48:50Z |
1029
|
|
|
|
|
|
|
|
1030
|
|
|
|
|
|
|
# $date->epoch; # 602228930 |
1031
|
|
|
|
|
|
|
|
1032
|
|
|
|
|
|
|
=back |
1033
|
|
|
|
|
|
|
|
1034
|
|
|
|
|
|
|
=over 4 |
1035
|
|
|
|
|
|
|
|
1036
|
|
|
|
|
|
|
=item add_years example 2 |
1037
|
|
|
|
|
|
|
|
1038
|
|
|
|
|
|
|
# given: synopsis; |
1039
|
|
|
|
|
|
|
|
1040
|
|
|
|
|
|
|
$date = $date->add_years(50); |
1041
|
|
|
|
|
|
|
|
1042
|
|
|
|
|
|
|
# $date->string; # 2038-01-31T02:41:40Z |
1043
|
|
|
|
|
|
|
|
1044
|
|
|
|
|
|
|
# $date->epoch; # 2148518500 |
1045
|
|
|
|
|
|
|
|
1046
|
|
|
|
|
|
|
=back |
1047
|
|
|
|
|
|
|
|
1048
|
|
|
|
|
|
|
=over 4 |
1049
|
|
|
|
|
|
|
|
1050
|
|
|
|
|
|
|
=item add_years example 3 |
1051
|
|
|
|
|
|
|
|
1052
|
|
|
|
|
|
|
# given: synopsis; |
1053
|
|
|
|
|
|
|
|
1054
|
|
|
|
|
|
|
$date = $date->add_years(-1); |
1055
|
|
|
|
|
|
|
|
1056
|
|
|
|
|
|
|
# $date->string; # 1987-01-31T18:11:10Z |
1057
|
|
|
|
|
|
|
|
1058
|
|
|
|
|
|
|
# $date->epoch; # 539115070 |
1059
|
|
|
|
|
|
|
|
1060
|
|
|
|
|
|
|
=back |
1061
|
|
|
|
|
|
|
|
1062
|
|
|
|
|
|
|
=cut |
1063
|
|
|
|
|
|
|
|
1064
|
|
|
|
|
|
|
=head2 epoch |
1065
|
|
|
|
|
|
|
|
1066
|
|
|
|
|
|
|
epoch() (number) |
1067
|
|
|
|
|
|
|
|
1068
|
|
|
|
|
|
|
The epoch method returns the epoch. |
1069
|
|
|
|
|
|
|
|
1070
|
|
|
|
|
|
|
I> |
1071
|
|
|
|
|
|
|
|
1072
|
|
|
|
|
|
|
=over 4 |
1073
|
|
|
|
|
|
|
|
1074
|
|
|
|
|
|
|
=item epoch example 1 |
1075
|
|
|
|
|
|
|
|
1076
|
|
|
|
|
|
|
# given: synopsis; |
1077
|
|
|
|
|
|
|
|
1078
|
|
|
|
|
|
|
my $epoch = $date->epoch; |
1079
|
|
|
|
|
|
|
|
1080
|
|
|
|
|
|
|
# 570672000 |
1081
|
|
|
|
|
|
|
|
1082
|
|
|
|
|
|
|
=back |
1083
|
|
|
|
|
|
|
|
1084
|
|
|
|
|
|
|
=cut |
1085
|
|
|
|
|
|
|
|
1086
|
|
|
|
|
|
|
=head2 explain |
1087
|
|
|
|
|
|
|
|
1088
|
|
|
|
|
|
|
explain() (number) |
1089
|
|
|
|
|
|
|
|
1090
|
|
|
|
|
|
|
The explain method returns the epoch and is used in stringification operations. |
1091
|
|
|
|
|
|
|
|
1092
|
|
|
|
|
|
|
I> |
1093
|
|
|
|
|
|
|
|
1094
|
|
|
|
|
|
|
=over 4 |
1095
|
|
|
|
|
|
|
|
1096
|
|
|
|
|
|
|
=item explain example 1 |
1097
|
|
|
|
|
|
|
|
1098
|
|
|
|
|
|
|
# given: synopsis; |
1099
|
|
|
|
|
|
|
|
1100
|
|
|
|
|
|
|
my $explain = $date->explain; |
1101
|
|
|
|
|
|
|
|
1102
|
|
|
|
|
|
|
# 570672000 |
1103
|
|
|
|
|
|
|
|
1104
|
|
|
|
|
|
|
=back |
1105
|
|
|
|
|
|
|
|
1106
|
|
|
|
|
|
|
=cut |
1107
|
|
|
|
|
|
|
|
1108
|
|
|
|
|
|
|
=head2 format |
1109
|
|
|
|
|
|
|
|
1110
|
|
|
|
|
|
|
format(string $format) (string) |
1111
|
|
|
|
|
|
|
|
1112
|
|
|
|
|
|
|
The format method returns the formatted date and time string. See |
1113
|
|
|
|
|
|
|
L for formatting |
1114
|
|
|
|
|
|
|
rules. |
1115
|
|
|
|
|
|
|
|
1116
|
|
|
|
|
|
|
I> |
1117
|
|
|
|
|
|
|
|
1118
|
|
|
|
|
|
|
=over 4 |
1119
|
|
|
|
|
|
|
|
1120
|
|
|
|
|
|
|
=item format example 1 |
1121
|
|
|
|
|
|
|
|
1122
|
|
|
|
|
|
|
# given: synopsis; |
1123
|
|
|
|
|
|
|
|
1124
|
|
|
|
|
|
|
my $format = $date->format('%A, %B %e, %Y'); |
1125
|
|
|
|
|
|
|
|
1126
|
|
|
|
|
|
|
# Monday, February 1, 1988 |
1127
|
|
|
|
|
|
|
|
1128
|
|
|
|
|
|
|
=back |
1129
|
|
|
|
|
|
|
|
1130
|
|
|
|
|
|
|
=over 4 |
1131
|
|
|
|
|
|
|
|
1132
|
|
|
|
|
|
|
=item format example 2 |
1133
|
|
|
|
|
|
|
|
1134
|
|
|
|
|
|
|
# given: synopsis; |
1135
|
|
|
|
|
|
|
|
1136
|
|
|
|
|
|
|
my $format = $date->format('%b %e %a'); |
1137
|
|
|
|
|
|
|
|
1138
|
|
|
|
|
|
|
# Feb 1 Mon |
1139
|
|
|
|
|
|
|
|
1140
|
|
|
|
|
|
|
=back |
1141
|
|
|
|
|
|
|
|
1142
|
|
|
|
|
|
|
=cut |
1143
|
|
|
|
|
|
|
|
1144
|
|
|
|
|
|
|
=head2 hms |
1145
|
|
|
|
|
|
|
|
1146
|
|
|
|
|
|
|
hms() (string) |
1147
|
|
|
|
|
|
|
|
1148
|
|
|
|
|
|
|
The hms method returns the time formatted as C. |
1149
|
|
|
|
|
|
|
|
1150
|
|
|
|
|
|
|
I> |
1151
|
|
|
|
|
|
|
|
1152
|
|
|
|
|
|
|
=over 4 |
1153
|
|
|
|
|
|
|
|
1154
|
|
|
|
|
|
|
=item hms example 1 |
1155
|
|
|
|
|
|
|
|
1156
|
|
|
|
|
|
|
# given: synopsis; |
1157
|
|
|
|
|
|
|
|
1158
|
|
|
|
|
|
|
my $hms = $date->hms; |
1159
|
|
|
|
|
|
|
|
1160
|
|
|
|
|
|
|
# 00:00:00 |
1161
|
|
|
|
|
|
|
|
1162
|
|
|
|
|
|
|
=back |
1163
|
|
|
|
|
|
|
|
1164
|
|
|
|
|
|
|
=cut |
1165
|
|
|
|
|
|
|
|
1166
|
|
|
|
|
|
|
=head2 iso8601 |
1167
|
|
|
|
|
|
|
|
1168
|
|
|
|
|
|
|
iso8601() (string) |
1169
|
|
|
|
|
|
|
|
1170
|
|
|
|
|
|
|
The iso8601 method returns the date and time formatted as an ISO8601 string. |
1171
|
|
|
|
|
|
|
|
1172
|
|
|
|
|
|
|
I> |
1173
|
|
|
|
|
|
|
|
1174
|
|
|
|
|
|
|
=over 4 |
1175
|
|
|
|
|
|
|
|
1176
|
|
|
|
|
|
|
=item iso8601 example 1 |
1177
|
|
|
|
|
|
|
|
1178
|
|
|
|
|
|
|
# given: synopsis; |
1179
|
|
|
|
|
|
|
|
1180
|
|
|
|
|
|
|
my $iso8601 = $date->iso8601; |
1181
|
|
|
|
|
|
|
|
1182
|
|
|
|
|
|
|
# 1988-02-01T00:00:00 |
1183
|
|
|
|
|
|
|
|
1184
|
|
|
|
|
|
|
=back |
1185
|
|
|
|
|
|
|
|
1186
|
|
|
|
|
|
|
=cut |
1187
|
|
|
|
|
|
|
|
1188
|
|
|
|
|
|
|
=head2 mdy |
1189
|
|
|
|
|
|
|
|
1190
|
|
|
|
|
|
|
mdy() (string) |
1191
|
|
|
|
|
|
|
|
1192
|
|
|
|
|
|
|
The mdy method returns the date formatted as C. |
1193
|
|
|
|
|
|
|
|
1194
|
|
|
|
|
|
|
I> |
1195
|
|
|
|
|
|
|
|
1196
|
|
|
|
|
|
|
=over 4 |
1197
|
|
|
|
|
|
|
|
1198
|
|
|
|
|
|
|
=item mdy example 1 |
1199
|
|
|
|
|
|
|
|
1200
|
|
|
|
|
|
|
# given: synopsis; |
1201
|
|
|
|
|
|
|
|
1202
|
|
|
|
|
|
|
my $mdy = $date->mdy; |
1203
|
|
|
|
|
|
|
|
1204
|
|
|
|
|
|
|
# 02-01-1988 |
1205
|
|
|
|
|
|
|
|
1206
|
|
|
|
|
|
|
=back |
1207
|
|
|
|
|
|
|
|
1208
|
|
|
|
|
|
|
=cut |
1209
|
|
|
|
|
|
|
|
1210
|
|
|
|
|
|
|
=head2 parse |
1211
|
|
|
|
|
|
|
|
1212
|
|
|
|
|
|
|
parse(any @data) (Venus::Date) |
1213
|
|
|
|
|
|
|
|
1214
|
|
|
|
|
|
|
The parse method resets and returns a date object based on the parsed time |
1215
|
|
|
|
|
|
|
provided. See L for |
1216
|
|
|
|
|
|
|
parsing rules. |
1217
|
|
|
|
|
|
|
|
1218
|
|
|
|
|
|
|
I> |
1219
|
|
|
|
|
|
|
|
1220
|
|
|
|
|
|
|
=over 4 |
1221
|
|
|
|
|
|
|
|
1222
|
|
|
|
|
|
|
=item parse example 1 |
1223
|
|
|
|
|
|
|
|
1224
|
|
|
|
|
|
|
# given: synopsis; |
1225
|
|
|
|
|
|
|
|
1226
|
|
|
|
|
|
|
$date = $date->parse('Monday, February 1, 1988', '%A, %B %e, %Y'); |
1227
|
|
|
|
|
|
|
|
1228
|
|
|
|
|
|
|
# $date->string; # 1988-02-01T00:00:00Z |
1229
|
|
|
|
|
|
|
|
1230
|
|
|
|
|
|
|
# $date->epoch; # 570672000 |
1231
|
|
|
|
|
|
|
|
1232
|
|
|
|
|
|
|
=back |
1233
|
|
|
|
|
|
|
|
1234
|
|
|
|
|
|
|
=cut |
1235
|
|
|
|
|
|
|
|
1236
|
|
|
|
|
|
|
=head2 reset |
1237
|
|
|
|
|
|
|
|
1238
|
|
|
|
|
|
|
reset(number $time) (Venus::Date) |
1239
|
|
|
|
|
|
|
|
1240
|
|
|
|
|
|
|
The reset method resets all attributes to correspond with the epoch provided. |
1241
|
|
|
|
|
|
|
|
1242
|
|
|
|
|
|
|
I> |
1243
|
|
|
|
|
|
|
|
1244
|
|
|
|
|
|
|
=over 4 |
1245
|
|
|
|
|
|
|
|
1246
|
|
|
|
|
|
|
=item reset example 1 |
1247
|
|
|
|
|
|
|
|
1248
|
|
|
|
|
|
|
# given: synopsis; |
1249
|
|
|
|
|
|
|
|
1250
|
|
|
|
|
|
|
$date = $date->reset(631152000); |
1251
|
|
|
|
|
|
|
|
1252
|
|
|
|
|
|
|
# $date->string; # 1990-01-01T00:00:00Z |
1253
|
|
|
|
|
|
|
|
1254
|
|
|
|
|
|
|
# $date->epoch; # 631152000 |
1255
|
|
|
|
|
|
|
|
1256
|
|
|
|
|
|
|
=back |
1257
|
|
|
|
|
|
|
|
1258
|
|
|
|
|
|
|
=cut |
1259
|
|
|
|
|
|
|
|
1260
|
|
|
|
|
|
|
=head2 restart |
1261
|
|
|
|
|
|
|
|
1262
|
|
|
|
|
|
|
restart(string $interval) (Venus::Date) |
1263
|
|
|
|
|
|
|
|
1264
|
|
|
|
|
|
|
The restart method truncates the date and time to the specified unit of time, |
1265
|
|
|
|
|
|
|
e.g. C, C, C, C, C, C, C. |
1266
|
|
|
|
|
|
|
|
1267
|
|
|
|
|
|
|
I> |
1268
|
|
|
|
|
|
|
|
1269
|
|
|
|
|
|
|
=over 4 |
1270
|
|
|
|
|
|
|
|
1271
|
|
|
|
|
|
|
=item restart example 1 |
1272
|
|
|
|
|
|
|
|
1273
|
|
|
|
|
|
|
# given: synopsis; |
1274
|
|
|
|
|
|
|
|
1275
|
|
|
|
|
|
|
$date = $date->restart('year'); |
1276
|
|
|
|
|
|
|
|
1277
|
|
|
|
|
|
|
# $date->string; # 1988-01-01T00:00:00Z |
1278
|
|
|
|
|
|
|
|
1279
|
|
|
|
|
|
|
# $date->epoch; # 567993600 |
1280
|
|
|
|
|
|
|
|
1281
|
|
|
|
|
|
|
=back |
1282
|
|
|
|
|
|
|
|
1283
|
|
|
|
|
|
|
=over 4 |
1284
|
|
|
|
|
|
|
|
1285
|
|
|
|
|
|
|
=item restart example 2 |
1286
|
|
|
|
|
|
|
|
1287
|
|
|
|
|
|
|
# given: synopsis; |
1288
|
|
|
|
|
|
|
|
1289
|
|
|
|
|
|
|
$date = $date->restart('quarter'); |
1290
|
|
|
|
|
|
|
|
1291
|
|
|
|
|
|
|
# $date->string; # 1988-01-01T00:00:00Z |
1292
|
|
|
|
|
|
|
|
1293
|
|
|
|
|
|
|
# $date->epoch; # 567993600 |
1294
|
|
|
|
|
|
|
|
1295
|
|
|
|
|
|
|
=back |
1296
|
|
|
|
|
|
|
|
1297
|
|
|
|
|
|
|
=over 4 |
1298
|
|
|
|
|
|
|
|
1299
|
|
|
|
|
|
|
=item restart example 3 |
1300
|
|
|
|
|
|
|
|
1301
|
|
|
|
|
|
|
# given: synopsis; |
1302
|
|
|
|
|
|
|
|
1303
|
|
|
|
|
|
|
$date = $date->restart('month'); |
1304
|
|
|
|
|
|
|
|
1305
|
|
|
|
|
|
|
# $date->string; # 1988-02-01T00:00:00Z |
1306
|
|
|
|
|
|
|
|
1307
|
|
|
|
|
|
|
# $date->epoch; # 570672000 |
1308
|
|
|
|
|
|
|
|
1309
|
|
|
|
|
|
|
=back |
1310
|
|
|
|
|
|
|
|
1311
|
|
|
|
|
|
|
=cut |
1312
|
|
|
|
|
|
|
|
1313
|
|
|
|
|
|
|
=head2 restart_day |
1314
|
|
|
|
|
|
|
|
1315
|
|
|
|
|
|
|
restart_day() (Venus::Date) |
1316
|
|
|
|
|
|
|
|
1317
|
|
|
|
|
|
|
The restart_day method truncates the date and time to the C. |
1318
|
|
|
|
|
|
|
|
1319
|
|
|
|
|
|
|
I> |
1320
|
|
|
|
|
|
|
|
1321
|
|
|
|
|
|
|
=over 4 |
1322
|
|
|
|
|
|
|
|
1323
|
|
|
|
|
|
|
=item restart_day example 1 |
1324
|
|
|
|
|
|
|
|
1325
|
|
|
|
|
|
|
# given: synopsis; |
1326
|
|
|
|
|
|
|
|
1327
|
|
|
|
|
|
|
$date = $date->restart_day; |
1328
|
|
|
|
|
|
|
|
1329
|
|
|
|
|
|
|
# $date->string; # 1988-02-01T00:00:00Z |
1330
|
|
|
|
|
|
|
|
1331
|
|
|
|
|
|
|
# $date->epoch; # 570672000 |
1332
|
|
|
|
|
|
|
|
1333
|
|
|
|
|
|
|
=back |
1334
|
|
|
|
|
|
|
|
1335
|
|
|
|
|
|
|
=cut |
1336
|
|
|
|
|
|
|
|
1337
|
|
|
|
|
|
|
=head2 restart_hour |
1338
|
|
|
|
|
|
|
|
1339
|
|
|
|
|
|
|
restart_hour() (Venus::Date) |
1340
|
|
|
|
|
|
|
|
1341
|
|
|
|
|
|
|
The restart_hour method truncates the date and time to the C. |
1342
|
|
|
|
|
|
|
|
1343
|
|
|
|
|
|
|
I> |
1344
|
|
|
|
|
|
|
|
1345
|
|
|
|
|
|
|
=over 4 |
1346
|
|
|
|
|
|
|
|
1347
|
|
|
|
|
|
|
=item restart_hour example 1 |
1348
|
|
|
|
|
|
|
|
1349
|
|
|
|
|
|
|
# given: synopsis; |
1350
|
|
|
|
|
|
|
|
1351
|
|
|
|
|
|
|
$date = $date->restart_hour; |
1352
|
|
|
|
|
|
|
|
1353
|
|
|
|
|
|
|
# $date->string; # 1988-02-01T00:00:00Z |
1354
|
|
|
|
|
|
|
|
1355
|
|
|
|
|
|
|
# $date->epoch; # 570672000 |
1356
|
|
|
|
|
|
|
|
1357
|
|
|
|
|
|
|
=back |
1358
|
|
|
|
|
|
|
|
1359
|
|
|
|
|
|
|
=cut |
1360
|
|
|
|
|
|
|
|
1361
|
|
|
|
|
|
|
=head2 restart_minute |
1362
|
|
|
|
|
|
|
|
1363
|
|
|
|
|
|
|
restart_minute() (Venus::Date) |
1364
|
|
|
|
|
|
|
|
1365
|
|
|
|
|
|
|
The restart_minute method truncates the date and time to the C. |
1366
|
|
|
|
|
|
|
|
1367
|
|
|
|
|
|
|
I> |
1368
|
|
|
|
|
|
|
|
1369
|
|
|
|
|
|
|
=over 4 |
1370
|
|
|
|
|
|
|
|
1371
|
|
|
|
|
|
|
=item restart_minute example 1 |
1372
|
|
|
|
|
|
|
|
1373
|
|
|
|
|
|
|
# given: synopsis; |
1374
|
|
|
|
|
|
|
|
1375
|
|
|
|
|
|
|
$date = $date->restart_minute; |
1376
|
|
|
|
|
|
|
|
1377
|
|
|
|
|
|
|
# $date->string; # 1988-02-01T00:00:00Z |
1378
|
|
|
|
|
|
|
|
1379
|
|
|
|
|
|
|
# $date->epoch; # 570672000 |
1380
|
|
|
|
|
|
|
|
1381
|
|
|
|
|
|
|
=back |
1382
|
|
|
|
|
|
|
|
1383
|
|
|
|
|
|
|
=cut |
1384
|
|
|
|
|
|
|
|
1385
|
|
|
|
|
|
|
=head2 restart_month |
1386
|
|
|
|
|
|
|
|
1387
|
|
|
|
|
|
|
restart_month() (Venus::Date) |
1388
|
|
|
|
|
|
|
|
1389
|
|
|
|
|
|
|
The restart_month method truncates the date and time to the C. |
1390
|
|
|
|
|
|
|
|
1391
|
|
|
|
|
|
|
I> |
1392
|
|
|
|
|
|
|
|
1393
|
|
|
|
|
|
|
=over 4 |
1394
|
|
|
|
|
|
|
|
1395
|
|
|
|
|
|
|
=item restart_month example 1 |
1396
|
|
|
|
|
|
|
|
1397
|
|
|
|
|
|
|
# given: synopsis; |
1398
|
|
|
|
|
|
|
|
1399
|
|
|
|
|
|
|
$date = $date->restart_month; |
1400
|
|
|
|
|
|
|
|
1401
|
|
|
|
|
|
|
# $date->string; # 1988-02-01T00:00:00Z |
1402
|
|
|
|
|
|
|
|
1403
|
|
|
|
|
|
|
# $date->epoch; # 570672000 |
1404
|
|
|
|
|
|
|
|
1405
|
|
|
|
|
|
|
=back |
1406
|
|
|
|
|
|
|
|
1407
|
|
|
|
|
|
|
=cut |
1408
|
|
|
|
|
|
|
|
1409
|
|
|
|
|
|
|
=head2 restart_quarter |
1410
|
|
|
|
|
|
|
|
1411
|
|
|
|
|
|
|
restart_quarter() (Venus::Date) |
1412
|
|
|
|
|
|
|
|
1413
|
|
|
|
|
|
|
The restart_quarter method truncates the date and time to the C. |
1414
|
|
|
|
|
|
|
|
1415
|
|
|
|
|
|
|
I> |
1416
|
|
|
|
|
|
|
|
1417
|
|
|
|
|
|
|
=over 4 |
1418
|
|
|
|
|
|
|
|
1419
|
|
|
|
|
|
|
=item restart_quarter example 1 |
1420
|
|
|
|
|
|
|
|
1421
|
|
|
|
|
|
|
# given: synopsis; |
1422
|
|
|
|
|
|
|
|
1423
|
|
|
|
|
|
|
$date = $date->restart_quarter; |
1424
|
|
|
|
|
|
|
|
1425
|
|
|
|
|
|
|
# $date->string; # 1988-01-01T00:00:00Z |
1426
|
|
|
|
|
|
|
|
1427
|
|
|
|
|
|
|
# $date->epoch; # 567993600 |
1428
|
|
|
|
|
|
|
|
1429
|
|
|
|
|
|
|
=back |
1430
|
|
|
|
|
|
|
|
1431
|
|
|
|
|
|
|
=cut |
1432
|
|
|
|
|
|
|
|
1433
|
|
|
|
|
|
|
=head2 restart_second |
1434
|
|
|
|
|
|
|
|
1435
|
|
|
|
|
|
|
restart_second() (Venus::Date) |
1436
|
|
|
|
|
|
|
|
1437
|
|
|
|
|
|
|
The restart_second method truncates the date and time to the C. |
1438
|
|
|
|
|
|
|
|
1439
|
|
|
|
|
|
|
I> |
1440
|
|
|
|
|
|
|
|
1441
|
|
|
|
|
|
|
=over 4 |
1442
|
|
|
|
|
|
|
|
1443
|
|
|
|
|
|
|
=item restart_second example 1 |
1444
|
|
|
|
|
|
|
|
1445
|
|
|
|
|
|
|
# given: synopsis; |
1446
|
|
|
|
|
|
|
|
1447
|
|
|
|
|
|
|
$date = $date->restart_second; |
1448
|
|
|
|
|
|
|
|
1449
|
|
|
|
|
|
|
# $date->string; # 1988-02-01T00:00:00Z |
1450
|
|
|
|
|
|
|
|
1451
|
|
|
|
|
|
|
# $date->epoch; # 570672000 |
1452
|
|
|
|
|
|
|
|
1453
|
|
|
|
|
|
|
=back |
1454
|
|
|
|
|
|
|
|
1455
|
|
|
|
|
|
|
=cut |
1456
|
|
|
|
|
|
|
|
1457
|
|
|
|
|
|
|
=head2 restart_year |
1458
|
|
|
|
|
|
|
|
1459
|
|
|
|
|
|
|
restart_year() (Venus::Date) |
1460
|
|
|
|
|
|
|
|
1461
|
|
|
|
|
|
|
The restart_year method truncates the date and time to the C. |
1462
|
|
|
|
|
|
|
|
1463
|
|
|
|
|
|
|
I> |
1464
|
|
|
|
|
|
|
|
1465
|
|
|
|
|
|
|
=over 4 |
1466
|
|
|
|
|
|
|
|
1467
|
|
|
|
|
|
|
=item restart_year example 1 |
1468
|
|
|
|
|
|
|
|
1469
|
|
|
|
|
|
|
# given: synopsis; |
1470
|
|
|
|
|
|
|
|
1471
|
|
|
|
|
|
|
$date = $date->restart_year; |
1472
|
|
|
|
|
|
|
|
1473
|
|
|
|
|
|
|
# $date->string; # 1988-01-01T00:00:00Z |
1474
|
|
|
|
|
|
|
|
1475
|
|
|
|
|
|
|
# $date->epoch; # 567993600 |
1476
|
|
|
|
|
|
|
|
1477
|
|
|
|
|
|
|
=back |
1478
|
|
|
|
|
|
|
|
1479
|
|
|
|
|
|
|
=cut |
1480
|
|
|
|
|
|
|
|
1481
|
|
|
|
|
|
|
=head2 rfc1123 |
1482
|
|
|
|
|
|
|
|
1483
|
|
|
|
|
|
|
rfc1123() (string) |
1484
|
|
|
|
|
|
|
|
1485
|
|
|
|
|
|
|
The rfc1123 method returns the date and time formatted as an RFC1123 string. |
1486
|
|
|
|
|
|
|
|
1487
|
|
|
|
|
|
|
I> |
1488
|
|
|
|
|
|
|
|
1489
|
|
|
|
|
|
|
=over 4 |
1490
|
|
|
|
|
|
|
|
1491
|
|
|
|
|
|
|
=item rfc1123 example 1 |
1492
|
|
|
|
|
|
|
|
1493
|
|
|
|
|
|
|
# given: synopsis; |
1494
|
|
|
|
|
|
|
|
1495
|
|
|
|
|
|
|
my $rfc1123 = $date->rfc1123; |
1496
|
|
|
|
|
|
|
|
1497
|
|
|
|
|
|
|
# Mon, 01 Feb 1988 00:00:00 GMT |
1498
|
|
|
|
|
|
|
|
1499
|
|
|
|
|
|
|
=back |
1500
|
|
|
|
|
|
|
|
1501
|
|
|
|
|
|
|
=cut |
1502
|
|
|
|
|
|
|
|
1503
|
|
|
|
|
|
|
=head2 rfc3339 |
1504
|
|
|
|
|
|
|
|
1505
|
|
|
|
|
|
|
rfc3339() (string) |
1506
|
|
|
|
|
|
|
|
1507
|
|
|
|
|
|
|
The rfc3339 method returns the date and time formatted as an RFC3339 string. |
1508
|
|
|
|
|
|
|
|
1509
|
|
|
|
|
|
|
I> |
1510
|
|
|
|
|
|
|
|
1511
|
|
|
|
|
|
|
=over 4 |
1512
|
|
|
|
|
|
|
|
1513
|
|
|
|
|
|
|
=item rfc3339 example 1 |
1514
|
|
|
|
|
|
|
|
1515
|
|
|
|
|
|
|
# given: synopsis; |
1516
|
|
|
|
|
|
|
|
1517
|
|
|
|
|
|
|
my $rfc3339 = $date->rfc3339; |
1518
|
|
|
|
|
|
|
|
1519
|
|
|
|
|
|
|
# 1988-02-01T00:00:00Z |
1520
|
|
|
|
|
|
|
|
1521
|
|
|
|
|
|
|
=back |
1522
|
|
|
|
|
|
|
|
1523
|
|
|
|
|
|
|
=cut |
1524
|
|
|
|
|
|
|
|
1525
|
|
|
|
|
|
|
=head2 rfc7231 |
1526
|
|
|
|
|
|
|
|
1527
|
|
|
|
|
|
|
rfc7231() (string) |
1528
|
|
|
|
|
|
|
|
1529
|
|
|
|
|
|
|
The rfc7231 method returns the date and time formatted as an RFC7231 string. |
1530
|
|
|
|
|
|
|
|
1531
|
|
|
|
|
|
|
I> |
1532
|
|
|
|
|
|
|
|
1533
|
|
|
|
|
|
|
=over 4 |
1534
|
|
|
|
|
|
|
|
1535
|
|
|
|
|
|
|
=item rfc7231 example 1 |
1536
|
|
|
|
|
|
|
|
1537
|
|
|
|
|
|
|
# given: synopsis; |
1538
|
|
|
|
|
|
|
|
1539
|
|
|
|
|
|
|
my $rfc7231 = $date->rfc7231; |
1540
|
|
|
|
|
|
|
|
1541
|
|
|
|
|
|
|
# Mon, 01 Feb 1988 00:00:00 UTC |
1542
|
|
|
|
|
|
|
|
1543
|
|
|
|
|
|
|
=back |
1544
|
|
|
|
|
|
|
|
1545
|
|
|
|
|
|
|
=cut |
1546
|
|
|
|
|
|
|
|
1547
|
|
|
|
|
|
|
=head2 rfc822 |
1548
|
|
|
|
|
|
|
|
1549
|
|
|
|
|
|
|
rfc822() (string) |
1550
|
|
|
|
|
|
|
|
1551
|
|
|
|
|
|
|
The rfc822 method returns the date and time formatted as an RFC822 string. |
1552
|
|
|
|
|
|
|
|
1553
|
|
|
|
|
|
|
I> |
1554
|
|
|
|
|
|
|
|
1555
|
|
|
|
|
|
|
=over 4 |
1556
|
|
|
|
|
|
|
|
1557
|
|
|
|
|
|
|
=item rfc822 example 1 |
1558
|
|
|
|
|
|
|
|
1559
|
|
|
|
|
|
|
# given: synopsis; |
1560
|
|
|
|
|
|
|
|
1561
|
|
|
|
|
|
|
my $rfc822 = $date->rfc822; |
1562
|
|
|
|
|
|
|
|
1563
|
|
|
|
|
|
|
# Mon, 01 Feb 1988 00:00:00 +0000 |
1564
|
|
|
|
|
|
|
|
1565
|
|
|
|
|
|
|
=back |
1566
|
|
|
|
|
|
|
|
1567
|
|
|
|
|
|
|
=cut |
1568
|
|
|
|
|
|
|
|
1569
|
|
|
|
|
|
|
=head2 set |
1570
|
|
|
|
|
|
|
|
1571
|
|
|
|
|
|
|
set(hashref $data) (Venus::Date) |
1572
|
|
|
|
|
|
|
|
1573
|
|
|
|
|
|
|
The set method sets the date and time attributes specified. |
1574
|
|
|
|
|
|
|
|
1575
|
|
|
|
|
|
|
I> |
1576
|
|
|
|
|
|
|
|
1577
|
|
|
|
|
|
|
=over 4 |
1578
|
|
|
|
|
|
|
|
1579
|
|
|
|
|
|
|
=item set example 1 |
1580
|
|
|
|
|
|
|
|
1581
|
|
|
|
|
|
|
# given: synopsis; |
1582
|
|
|
|
|
|
|
|
1583
|
|
|
|
|
|
|
$date = $date->set({ |
1584
|
|
|
|
|
|
|
day => 1, |
1585
|
|
|
|
|
|
|
month => 1, |
1586
|
|
|
|
|
|
|
year => 2000, |
1587
|
|
|
|
|
|
|
}); |
1588
|
|
|
|
|
|
|
|
1589
|
|
|
|
|
|
|
# $date->string; # 2000-01-01T00:00:00Z |
1590
|
|
|
|
|
|
|
|
1591
|
|
|
|
|
|
|
# $date->epoch; # 946684800 |
1592
|
|
|
|
|
|
|
|
1593
|
|
|
|
|
|
|
=back |
1594
|
|
|
|
|
|
|
|
1595
|
|
|
|
|
|
|
=over 4 |
1596
|
|
|
|
|
|
|
|
1597
|
|
|
|
|
|
|
=item set example 2 |
1598
|
|
|
|
|
|
|
|
1599
|
|
|
|
|
|
|
# given: synopsis; |
1600
|
|
|
|
|
|
|
|
1601
|
|
|
|
|
|
|
$date = $date->set({ |
1602
|
|
|
|
|
|
|
day => 1, |
1603
|
|
|
|
|
|
|
month => 12, |
1604
|
|
|
|
|
|
|
}); |
1605
|
|
|
|
|
|
|
|
1606
|
|
|
|
|
|
|
# $date->string; # 1988-12-01T00:00:00Z |
1607
|
|
|
|
|
|
|
|
1608
|
|
|
|
|
|
|
# $date->epoch; # 596937600 |
1609
|
|
|
|
|
|
|
|
1610
|
|
|
|
|
|
|
=back |
1611
|
|
|
|
|
|
|
|
1612
|
|
|
|
|
|
|
=over 4 |
1613
|
|
|
|
|
|
|
|
1614
|
|
|
|
|
|
|
=item set example 3 |
1615
|
|
|
|
|
|
|
|
1616
|
|
|
|
|
|
|
# given: synopsis; |
1617
|
|
|
|
|
|
|
|
1618
|
|
|
|
|
|
|
$date = $date->set({ |
1619
|
|
|
|
|
|
|
day => 1, |
1620
|
|
|
|
|
|
|
month => 12, |
1621
|
|
|
|
|
|
|
year => 1979, |
1622
|
|
|
|
|
|
|
}); |
1623
|
|
|
|
|
|
|
|
1624
|
|
|
|
|
|
|
# $date->string; # 1979-12-01T00:00:00Z |
1625
|
|
|
|
|
|
|
|
1626
|
|
|
|
|
|
|
# $date->epoch; # 312854400 |
1627
|
|
|
|
|
|
|
|
1628
|
|
|
|
|
|
|
=back |
1629
|
|
|
|
|
|
|
|
1630
|
|
|
|
|
|
|
=cut |
1631
|
|
|
|
|
|
|
|
1632
|
|
|
|
|
|
|
=head2 set_hms |
1633
|
|
|
|
|
|
|
|
1634
|
|
|
|
|
|
|
set_hms(maybe[number] $hours, maybe[number] $minutes, maybe[number] $seconds) (Venus::Date) |
1635
|
|
|
|
|
|
|
|
1636
|
|
|
|
|
|
|
The set_hms method sets the C, C, and C attributes. |
1637
|
|
|
|
|
|
|
|
1638
|
|
|
|
|
|
|
I> |
1639
|
|
|
|
|
|
|
|
1640
|
|
|
|
|
|
|
=over 4 |
1641
|
|
|
|
|
|
|
|
1642
|
|
|
|
|
|
|
=item set_hms example 1 |
1643
|
|
|
|
|
|
|
|
1644
|
|
|
|
|
|
|
# given: synopsis; |
1645
|
|
|
|
|
|
|
|
1646
|
|
|
|
|
|
|
$date = $date->set_hms(1, 0, 0); |
1647
|
|
|
|
|
|
|
|
1648
|
|
|
|
|
|
|
# $date->string; # 1988-02-01T01:00:00Z |
1649
|
|
|
|
|
|
|
|
1650
|
|
|
|
|
|
|
# $date->epoch; # 570675600 |
1651
|
|
|
|
|
|
|
|
1652
|
|
|
|
|
|
|
=back |
1653
|
|
|
|
|
|
|
|
1654
|
|
|
|
|
|
|
=over 4 |
1655
|
|
|
|
|
|
|
|
1656
|
|
|
|
|
|
|
=item set_hms example 2 |
1657
|
|
|
|
|
|
|
|
1658
|
|
|
|
|
|
|
# given: synopsis; |
1659
|
|
|
|
|
|
|
|
1660
|
|
|
|
|
|
|
$date = $date->set_hms(undef, 30, 30); |
1661
|
|
|
|
|
|
|
|
1662
|
|
|
|
|
|
|
# $date->string; # 1988-02-01T00:30:30Z |
1663
|
|
|
|
|
|
|
|
1664
|
|
|
|
|
|
|
# $date->epoch; # 570673830 |
1665
|
|
|
|
|
|
|
|
1666
|
|
|
|
|
|
|
=back |
1667
|
|
|
|
|
|
|
|
1668
|
|
|
|
|
|
|
=over 4 |
1669
|
|
|
|
|
|
|
|
1670
|
|
|
|
|
|
|
=item set_hms example 3 |
1671
|
|
|
|
|
|
|
|
1672
|
|
|
|
|
|
|
# given: synopsis; |
1673
|
|
|
|
|
|
|
|
1674
|
|
|
|
|
|
|
$date = $date->set_hms(0, 59, 59); |
1675
|
|
|
|
|
|
|
|
1676
|
|
|
|
|
|
|
# $date->string; # 1988-02-01T00:59:59Z |
1677
|
|
|
|
|
|
|
|
1678
|
|
|
|
|
|
|
# $date->epoch; # 570675599 |
1679
|
|
|
|
|
|
|
|
1680
|
|
|
|
|
|
|
=back |
1681
|
|
|
|
|
|
|
|
1682
|
|
|
|
|
|
|
=cut |
1683
|
|
|
|
|
|
|
|
1684
|
|
|
|
|
|
|
=head2 set_mdy |
1685
|
|
|
|
|
|
|
|
1686
|
|
|
|
|
|
|
set_mdy(maybe[number] $months, maybe[number] $days, maybe[number] $years) (Venus::Date) |
1687
|
|
|
|
|
|
|
|
1688
|
|
|
|
|
|
|
The set_mdy method sets the C, C, and C attributes. |
1689
|
|
|
|
|
|
|
|
1690
|
|
|
|
|
|
|
|
1691
|
|
|
|
|
|
|
|
1692
|
|
|
|
|
|
|
|
1693
|
|
|
|
|
|
|
I> |
1694
|
|
|
|
|
|
|
|
1695
|
|
|
|
|
|
|
=over 4 |
1696
|
|
|
|
|
|
|
|
1697
|
|
|
|
|
|
|
=item set_mdy example 1 |
1698
|
|
|
|
|
|
|
|
1699
|
|
|
|
|
|
|
# given: synopsis; |
1700
|
|
|
|
|
|
|
|
1701
|
|
|
|
|
|
|
$date = $date->set_mdy(4, 30, 1990); |
1702
|
|
|
|
|
|
|
|
1703
|
|
|
|
|
|
|
# $date->string; # 1990-04-30T00:00:00Z |
1704
|
|
|
|
|
|
|
|
1705
|
|
|
|
|
|
|
# $date->epoch; # 641433600 |
1706
|
|
|
|
|
|
|
|
1707
|
|
|
|
|
|
|
=back |
1708
|
|
|
|
|
|
|
|
1709
|
|
|
|
|
|
|
=over 4 |
1710
|
|
|
|
|
|
|
|
1711
|
|
|
|
|
|
|
=item set_mdy example 2 |
1712
|
|
|
|
|
|
|
|
1713
|
|
|
|
|
|
|
# given: synopsis; |
1714
|
|
|
|
|
|
|
|
1715
|
|
|
|
|
|
|
$date = $date->set_mdy(4, 30, undef); |
1716
|
|
|
|
|
|
|
|
1717
|
|
|
|
|
|
|
# $date->string; # 1988-04-30T00:00:00Z |
1718
|
|
|
|
|
|
|
|
1719
|
|
|
|
|
|
|
# $date->epoch; # 578361600 |
1720
|
|
|
|
|
|
|
|
1721
|
|
|
|
|
|
|
=back |
1722
|
|
|
|
|
|
|
|
1723
|
|
|
|
|
|
|
=over 4 |
1724
|
|
|
|
|
|
|
|
1725
|
|
|
|
|
|
|
=item set_mdy example 3 |
1726
|
|
|
|
|
|
|
|
1727
|
|
|
|
|
|
|
# given: synopsis; |
1728
|
|
|
|
|
|
|
|
1729
|
|
|
|
|
|
|
$date = $date->set_mdy(undef, 15, undef); |
1730
|
|
|
|
|
|
|
|
1731
|
|
|
|
|
|
|
# $date->string; # 1988-02-15T00:00:00Z |
1732
|
|
|
|
|
|
|
|
1733
|
|
|
|
|
|
|
# $date->epoch; # 571881600 |
1734
|
|
|
|
|
|
|
|
1735
|
|
|
|
|
|
|
=back |
1736
|
|
|
|
|
|
|
|
1737
|
|
|
|
|
|
|
=cut |
1738
|
|
|
|
|
|
|
|
1739
|
|
|
|
|
|
|
=head2 string |
1740
|
|
|
|
|
|
|
|
1741
|
|
|
|
|
|
|
string() (string) |
1742
|
|
|
|
|
|
|
|
1743
|
|
|
|
|
|
|
The string method returns a date and time string, and is an alias for |
1744
|
|
|
|
|
|
|
L. |
1745
|
|
|
|
|
|
|
|
1746
|
|
|
|
|
|
|
I> |
1747
|
|
|
|
|
|
|
|
1748
|
|
|
|
|
|
|
=over 4 |
1749
|
|
|
|
|
|
|
|
1750
|
|
|
|
|
|
|
=item string example 1 |
1751
|
|
|
|
|
|
|
|
1752
|
|
|
|
|
|
|
# given: synopsis; |
1753
|
|
|
|
|
|
|
|
1754
|
|
|
|
|
|
|
my $string = $date->string; |
1755
|
|
|
|
|
|
|
|
1756
|
|
|
|
|
|
|
# 1988-02-01T00:00:00Z |
1757
|
|
|
|
|
|
|
|
1758
|
|
|
|
|
|
|
=back |
1759
|
|
|
|
|
|
|
|
1760
|
|
|
|
|
|
|
=cut |
1761
|
|
|
|
|
|
|
|
1762
|
|
|
|
|
|
|
=head2 sub |
1763
|
|
|
|
|
|
|
|
1764
|
|
|
|
|
|
|
sub(hashref $data) (Venus::Date) |
1765
|
|
|
|
|
|
|
|
1766
|
|
|
|
|
|
|
The sub method method decrements the date and time attributes specified. |
1767
|
|
|
|
|
|
|
|
1768
|
|
|
|
|
|
|
I> |
1769
|
|
|
|
|
|
|
|
1770
|
|
|
|
|
|
|
=over 4 |
1771
|
|
|
|
|
|
|
|
1772
|
|
|
|
|
|
|
=item sub example 1 |
1773
|
|
|
|
|
|
|
|
1774
|
|
|
|
|
|
|
# given: synopsis; |
1775
|
|
|
|
|
|
|
|
1776
|
|
|
|
|
|
|
$date = $date->sub({ |
1777
|
|
|
|
|
|
|
days => 1, |
1778
|
|
|
|
|
|
|
months => 1, |
1779
|
|
|
|
|
|
|
years => 1, |
1780
|
|
|
|
|
|
|
}); |
1781
|
|
|
|
|
|
|
|
1782
|
|
|
|
|
|
|
# $date->string; # 1986-12-31T07:42:06Z |
1783
|
|
|
|
|
|
|
|
1784
|
|
|
|
|
|
|
# $date->epoch; # 536398926 |
1785
|
|
|
|
|
|
|
|
1786
|
|
|
|
|
|
|
=back |
1787
|
|
|
|
|
|
|
|
1788
|
|
|
|
|
|
|
=over 4 |
1789
|
|
|
|
|
|
|
|
1790
|
|
|
|
|
|
|
=item sub example 2 |
1791
|
|
|
|
|
|
|
|
1792
|
|
|
|
|
|
|
# given: synopsis; |
1793
|
|
|
|
|
|
|
|
1794
|
|
|
|
|
|
|
$date = $date->sub({ |
1795
|
|
|
|
|
|
|
hours => 1, |
1796
|
|
|
|
|
|
|
minutes => 1, |
1797
|
|
|
|
|
|
|
seconds => 1, |
1798
|
|
|
|
|
|
|
}); |
1799
|
|
|
|
|
|
|
|
1800
|
|
|
|
|
|
|
# $date->string; # 1988-01-31T22:58:59Z |
1801
|
|
|
|
|
|
|
|
1802
|
|
|
|
|
|
|
# $date->epoch; # 570668339 |
1803
|
|
|
|
|
|
|
|
1804
|
|
|
|
|
|
|
=back |
1805
|
|
|
|
|
|
|
|
1806
|
|
|
|
|
|
|
=cut |
1807
|
|
|
|
|
|
|
|
1808
|
|
|
|
|
|
|
=head2 sub_days |
1809
|
|
|
|
|
|
|
|
1810
|
|
|
|
|
|
|
sub_days(number $days) (Venus::Date) |
1811
|
|
|
|
|
|
|
|
1812
|
|
|
|
|
|
|
The sub_days method decrements the C attribute. |
1813
|
|
|
|
|
|
|
|
1814
|
|
|
|
|
|
|
I> |
1815
|
|
|
|
|
|
|
|
1816
|
|
|
|
|
|
|
=over 4 |
1817
|
|
|
|
|
|
|
|
1818
|
|
|
|
|
|
|
=item sub_days example 1 |
1819
|
|
|
|
|
|
|
|
1820
|
|
|
|
|
|
|
# given: synopsis; |
1821
|
|
|
|
|
|
|
|
1822
|
|
|
|
|
|
|
$date = $date->sub_days(1); |
1823
|
|
|
|
|
|
|
|
1824
|
|
|
|
|
|
|
# $date->string; # 1988-01-31T00:00:00Z |
1825
|
|
|
|
|
|
|
|
1826
|
|
|
|
|
|
|
# $date->epoch; # 570585600 |
1827
|
|
|
|
|
|
|
|
1828
|
|
|
|
|
|
|
=back |
1829
|
|
|
|
|
|
|
|
1830
|
|
|
|
|
|
|
=over 4 |
1831
|
|
|
|
|
|
|
|
1832
|
|
|
|
|
|
|
=item sub_days example 2 |
1833
|
|
|
|
|
|
|
|
1834
|
|
|
|
|
|
|
# given: synopsis; |
1835
|
|
|
|
|
|
|
|
1836
|
|
|
|
|
|
|
$date = $date->sub_days(32); |
1837
|
|
|
|
|
|
|
|
1838
|
|
|
|
|
|
|
# $date->string; # 1987-12-31T00:00:00Z |
1839
|
|
|
|
|
|
|
|
1840
|
|
|
|
|
|
|
# $date->epoch; # 567907200 |
1841
|
|
|
|
|
|
|
|
1842
|
|
|
|
|
|
|
=back |
1843
|
|
|
|
|
|
|
|
1844
|
|
|
|
|
|
|
=over 4 |
1845
|
|
|
|
|
|
|
|
1846
|
|
|
|
|
|
|
=item sub_days example 3 |
1847
|
|
|
|
|
|
|
|
1848
|
|
|
|
|
|
|
# given: synopsis; |
1849
|
|
|
|
|
|
|
|
1850
|
|
|
|
|
|
|
$date = $date->sub_days(-1); |
1851
|
|
|
|
|
|
|
|
1852
|
|
|
|
|
|
|
# $date->string; # 1988-02-02T00:00:00Z |
1853
|
|
|
|
|
|
|
|
1854
|
|
|
|
|
|
|
# $date->epoch; # 570758400 |
1855
|
|
|
|
|
|
|
|
1856
|
|
|
|
|
|
|
=back |
1857
|
|
|
|
|
|
|
|
1858
|
|
|
|
|
|
|
=cut |
1859
|
|
|
|
|
|
|
|
1860
|
|
|
|
|
|
|
=head2 sub_hms |
1861
|
|
|
|
|
|
|
|
1862
|
|
|
|
|
|
|
sub_hms(maybe[number] $hours, maybe[number] $minutes, maybe[number] $seconds) (Venus::Date) |
1863
|
|
|
|
|
|
|
|
1864
|
|
|
|
|
|
|
The sub_hms method decrements the C, C, and C attributes. |
1865
|
|
|
|
|
|
|
|
1866
|
|
|
|
|
|
|
I> |
1867
|
|
|
|
|
|
|
|
1868
|
|
|
|
|
|
|
=over 4 |
1869
|
|
|
|
|
|
|
|
1870
|
|
|
|
|
|
|
=item sub_hms example 1 |
1871
|
|
|
|
|
|
|
|
1872
|
|
|
|
|
|
|
# given: synopsis; |
1873
|
|
|
|
|
|
|
|
1874
|
|
|
|
|
|
|
$date = $date->sub_hms(1, 0, 0); |
1875
|
|
|
|
|
|
|
|
1876
|
|
|
|
|
|
|
# $date->string; # 1988-01-31T23:00:00Z |
1877
|
|
|
|
|
|
|
|
1878
|
|
|
|
|
|
|
# $date->epoch; # 570668400 |
1879
|
|
|
|
|
|
|
|
1880
|
|
|
|
|
|
|
=back |
1881
|
|
|
|
|
|
|
|
1882
|
|
|
|
|
|
|
=over 4 |
1883
|
|
|
|
|
|
|
|
1884
|
|
|
|
|
|
|
=item sub_hms example 2 |
1885
|
|
|
|
|
|
|
|
1886
|
|
|
|
|
|
|
# given: synopsis; |
1887
|
|
|
|
|
|
|
|
1888
|
|
|
|
|
|
|
$date = $date->sub_hms(undef, 1, 1); |
1889
|
|
|
|
|
|
|
|
1890
|
|
|
|
|
|
|
# $date->string; # 1988-01-31T23:58:59Z |
1891
|
|
|
|
|
|
|
|
1892
|
|
|
|
|
|
|
# $date->epoch; # 570671939 |
1893
|
|
|
|
|
|
|
|
1894
|
|
|
|
|
|
|
=back |
1895
|
|
|
|
|
|
|
|
1896
|
|
|
|
|
|
|
=over 4 |
1897
|
|
|
|
|
|
|
|
1898
|
|
|
|
|
|
|
=item sub_hms example 3 |
1899
|
|
|
|
|
|
|
|
1900
|
|
|
|
|
|
|
# given: synopsis; |
1901
|
|
|
|
|
|
|
|
1902
|
|
|
|
|
|
|
$date = $date->sub_hms(1, 1); |
1903
|
|
|
|
|
|
|
|
1904
|
|
|
|
|
|
|
# $date->string; # 1988-01-31T22:59:00Z |
1905
|
|
|
|
|
|
|
|
1906
|
|
|
|
|
|
|
# $date->epoch; # 570668340 |
1907
|
|
|
|
|
|
|
|
1908
|
|
|
|
|
|
|
=back |
1909
|
|
|
|
|
|
|
|
1910
|
|
|
|
|
|
|
=cut |
1911
|
|
|
|
|
|
|
|
1912
|
|
|
|
|
|
|
=head2 sub_hours |
1913
|
|
|
|
|
|
|
|
1914
|
|
|
|
|
|
|
sub_hours(number $hours) (any) |
1915
|
|
|
|
|
|
|
|
1916
|
|
|
|
|
|
|
The sub_hours method decrements the C attribute. |
1917
|
|
|
|
|
|
|
|
1918
|
|
|
|
|
|
|
I> |
1919
|
|
|
|
|
|
|
|
1920
|
|
|
|
|
|
|
=over 4 |
1921
|
|
|
|
|
|
|
|
1922
|
|
|
|
|
|
|
=item sub_hours example 1 |
1923
|
|
|
|
|
|
|
|
1924
|
|
|
|
|
|
|
# given: synopsis; |
1925
|
|
|
|
|
|
|
|
1926
|
|
|
|
|
|
|
$date = $date->sub_hours(1); |
1927
|
|
|
|
|
|
|
|
1928
|
|
|
|
|
|
|
# $date->string; # 1988-01-31T23:00:00Z |
1929
|
|
|
|
|
|
|
|
1930
|
|
|
|
|
|
|
# $date->epoch; # 570668400 |
1931
|
|
|
|
|
|
|
|
1932
|
|
|
|
|
|
|
=back |
1933
|
|
|
|
|
|
|
|
1934
|
|
|
|
|
|
|
=over 4 |
1935
|
|
|
|
|
|
|
|
1936
|
|
|
|
|
|
|
=item sub_hours example 2 |
1937
|
|
|
|
|
|
|
|
1938
|
|
|
|
|
|
|
# given: synopsis; |
1939
|
|
|
|
|
|
|
|
1940
|
|
|
|
|
|
|
$date = $date->sub_hours(25); |
1941
|
|
|
|
|
|
|
|
1942
|
|
|
|
|
|
|
# $date->string; # 1988-01-30T23:00:00Z |
1943
|
|
|
|
|
|
|
|
1944
|
|
|
|
|
|
|
# $date->epoch; # 570582000 |
1945
|
|
|
|
|
|
|
|
1946
|
|
|
|
|
|
|
=back |
1947
|
|
|
|
|
|
|
|
1948
|
|
|
|
|
|
|
=over 4 |
1949
|
|
|
|
|
|
|
|
1950
|
|
|
|
|
|
|
=item sub_hours example 3 |
1951
|
|
|
|
|
|
|
|
1952
|
|
|
|
|
|
|
# given: synopsis; |
1953
|
|
|
|
|
|
|
|
1954
|
|
|
|
|
|
|
$date = $date->sub_hours(-1); |
1955
|
|
|
|
|
|
|
|
1956
|
|
|
|
|
|
|
# $date->string; # 1988-02-01T01:00:00Z |
1957
|
|
|
|
|
|
|
|
1958
|
|
|
|
|
|
|
# $date->epoch; # 570675600 |
1959
|
|
|
|
|
|
|
|
1960
|
|
|
|
|
|
|
=back |
1961
|
|
|
|
|
|
|
|
1962
|
|
|
|
|
|
|
=cut |
1963
|
|
|
|
|
|
|
|
1964
|
|
|
|
|
|
|
=head2 sub_mdy |
1965
|
|
|
|
|
|
|
|
1966
|
|
|
|
|
|
|
sub_mdy(maybe[number] $months, maybe[number] $days, maybe[number] $years) (Venus::Date) |
1967
|
|
|
|
|
|
|
|
1968
|
|
|
|
|
|
|
The sub_mdy method decrements the C, C, and C attributes. |
1969
|
|
|
|
|
|
|
|
1970
|
|
|
|
|
|
|
I> |
1971
|
|
|
|
|
|
|
|
1972
|
|
|
|
|
|
|
=over 4 |
1973
|
|
|
|
|
|
|
|
1974
|
|
|
|
|
|
|
=item sub_mdy example 1 |
1975
|
|
|
|
|
|
|
|
1976
|
|
|
|
|
|
|
# given: synopsis; |
1977
|
|
|
|
|
|
|
|
1978
|
|
|
|
|
|
|
$date = $date->sub_mdy(1, 1, 1); |
1979
|
|
|
|
|
|
|
|
1980
|
|
|
|
|
|
|
# $date->string; # 1986-12-31T07:42:06Z |
1981
|
|
|
|
|
|
|
|
1982
|
|
|
|
|
|
|
# $date->epoch; # 536398926 |
1983
|
|
|
|
|
|
|
|
1984
|
|
|
|
|
|
|
=back |
1985
|
|
|
|
|
|
|
|
1986
|
|
|
|
|
|
|
=over 4 |
1987
|
|
|
|
|
|
|
|
1988
|
|
|
|
|
|
|
=item sub_mdy example 2 |
1989
|
|
|
|
|
|
|
|
1990
|
|
|
|
|
|
|
# given: synopsis; |
1991
|
|
|
|
|
|
|
|
1992
|
|
|
|
|
|
|
$date = $date->sub_mdy(1, 1, undef); |
1993
|
|
|
|
|
|
|
|
1994
|
|
|
|
|
|
|
# $date->string; # 1987-12-31T13:30:56Z |
1995
|
|
|
|
|
|
|
|
1996
|
|
|
|
|
|
|
# $date->epoch; # 567955856 |
1997
|
|
|
|
|
|
|
|
1998
|
|
|
|
|
|
|
=back |
1999
|
|
|
|
|
|
|
|
2000
|
|
|
|
|
|
|
=over 4 |
2001
|
|
|
|
|
|
|
|
2002
|
|
|
|
|
|
|
=item sub_mdy example 3 |
2003
|
|
|
|
|
|
|
|
2004
|
|
|
|
|
|
|
# given: synopsis; |
2005
|
|
|
|
|
|
|
|
2006
|
|
|
|
|
|
|
$date = $date->sub_mdy(1, 1); |
2007
|
|
|
|
|
|
|
|
2008
|
|
|
|
|
|
|
# $date->string; # 1987-12-31T13:30:56Z |
2009
|
|
|
|
|
|
|
|
2010
|
|
|
|
|
|
|
# $date->epoch; # 567955856 |
2011
|
|
|
|
|
|
|
|
2012
|
|
|
|
|
|
|
=back |
2013
|
|
|
|
|
|
|
|
2014
|
|
|
|
|
|
|
=cut |
2015
|
|
|
|
|
|
|
|
2016
|
|
|
|
|
|
|
=head2 sub_minutes |
2017
|
|
|
|
|
|
|
|
2018
|
|
|
|
|
|
|
sub_minutes(number $minutes) (Venus::Date) |
2019
|
|
|
|
|
|
|
|
2020
|
|
|
|
|
|
|
The sub_minutes method decrements the C attribute. |
2021
|
|
|
|
|
|
|
|
2022
|
|
|
|
|
|
|
I> |
2023
|
|
|
|
|
|
|
|
2024
|
|
|
|
|
|
|
=over 4 |
2025
|
|
|
|
|
|
|
|
2026
|
|
|
|
|
|
|
=item sub_minutes example 1 |
2027
|
|
|
|
|
|
|
|
2028
|
|
|
|
|
|
|
# given: synopsis; |
2029
|
|
|
|
|
|
|
|
2030
|
|
|
|
|
|
|
$date = $date->sub_minutes(1); |
2031
|
|
|
|
|
|
|
|
2032
|
|
|
|
|
|
|
# $date->string; # 1988-01-31T23:59:00Z |
2033
|
|
|
|
|
|
|
|
2034
|
|
|
|
|
|
|
# $date->epoch; # 570671940 |
2035
|
|
|
|
|
|
|
|
2036
|
|
|
|
|
|
|
=back |
2037
|
|
|
|
|
|
|
|
2038
|
|
|
|
|
|
|
=over 4 |
2039
|
|
|
|
|
|
|
|
2040
|
|
|
|
|
|
|
=item sub_minutes example 2 |
2041
|
|
|
|
|
|
|
|
2042
|
|
|
|
|
|
|
# given: synopsis; |
2043
|
|
|
|
|
|
|
|
2044
|
|
|
|
|
|
|
$date = $date->sub_minutes(61); |
2045
|
|
|
|
|
|
|
|
2046
|
|
|
|
|
|
|
# $date->string; # 1988-01-31T22:59:00Z |
2047
|
|
|
|
|
|
|
|
2048
|
|
|
|
|
|
|
# $date->epoch; # 570668340 |
2049
|
|
|
|
|
|
|
|
2050
|
|
|
|
|
|
|
=back |
2051
|
|
|
|
|
|
|
|
2052
|
|
|
|
|
|
|
=over 4 |
2053
|
|
|
|
|
|
|
|
2054
|
|
|
|
|
|
|
=item sub_minutes example 3 |
2055
|
|
|
|
|
|
|
|
2056
|
|
|
|
|
|
|
# given: synopsis; |
2057
|
|
|
|
|
|
|
|
2058
|
|
|
|
|
|
|
$date = $date->sub_minutes(-1); |
2059
|
|
|
|
|
|
|
|
2060
|
|
|
|
|
|
|
# $date->string; # 1988-02-01T00:01:00Z |
2061
|
|
|
|
|
|
|
|
2062
|
|
|
|
|
|
|
# $date->epoch; # 570672060 |
2063
|
|
|
|
|
|
|
|
2064
|
|
|
|
|
|
|
=back |
2065
|
|
|
|
|
|
|
|
2066
|
|
|
|
|
|
|
=cut |
2067
|
|
|
|
|
|
|
|
2068
|
|
|
|
|
|
|
=head2 sub_months |
2069
|
|
|
|
|
|
|
|
2070
|
|
|
|
|
|
|
sub_months(number $months) (Venus::Date) |
2071
|
|
|
|
|
|
|
|
2072
|
|
|
|
|
|
|
The sub_months method decrements the C attribute. |
2073
|
|
|
|
|
|
|
|
2074
|
|
|
|
|
|
|
I> |
2075
|
|
|
|
|
|
|
|
2076
|
|
|
|
|
|
|
=over 4 |
2077
|
|
|
|
|
|
|
|
2078
|
|
|
|
|
|
|
=item sub_months example 1 |
2079
|
|
|
|
|
|
|
|
2080
|
|
|
|
|
|
|
# given: synopsis; |
2081
|
|
|
|
|
|
|
|
2082
|
|
|
|
|
|
|
$date = $date->sub_months(1); |
2083
|
|
|
|
|
|
|
|
2084
|
|
|
|
|
|
|
# $date->string; # 1988-01-01T13:30:56Z |
2085
|
|
|
|
|
|
|
|
2086
|
|
|
|
|
|
|
# $date->epoch; # 568042256 |
2087
|
|
|
|
|
|
|
|
2088
|
|
|
|
|
|
|
=back |
2089
|
|
|
|
|
|
|
|
2090
|
|
|
|
|
|
|
=over 4 |
2091
|
|
|
|
|
|
|
|
2092
|
|
|
|
|
|
|
=item sub_months example 2 |
2093
|
|
|
|
|
|
|
|
2094
|
|
|
|
|
|
|
# given: synopsis; |
2095
|
|
|
|
|
|
|
|
2096
|
|
|
|
|
|
|
$date = $date->sub_months(13); |
2097
|
|
|
|
|
|
|
|
2098
|
|
|
|
|
|
|
# $date->string; # 1987-01-01T07:42:08Z |
2099
|
|
|
|
|
|
|
|
2100
|
|
|
|
|
|
|
# $date->epoch; # 536485328 |
2101
|
|
|
|
|
|
|
|
2102
|
|
|
|
|
|
|
=back |
2103
|
|
|
|
|
|
|
|
2104
|
|
|
|
|
|
|
=over 4 |
2105
|
|
|
|
|
|
|
|
2106
|
|
|
|
|
|
|
=item sub_months example 3 |
2107
|
|
|
|
|
|
|
|
2108
|
|
|
|
|
|
|
# given: synopsis; |
2109
|
|
|
|
|
|
|
|
2110
|
|
|
|
|
|
|
$date = $date->sub_months(-1); |
2111
|
|
|
|
|
|
|
|
2112
|
|
|
|
|
|
|
# $date->string; # 1988-03-02T10:29:04Z |
2113
|
|
|
|
|
|
|
|
2114
|
|
|
|
|
|
|
# $date->epoch; # 573301744 |
2115
|
|
|
|
|
|
|
|
2116
|
|
|
|
|
|
|
=back |
2117
|
|
|
|
|
|
|
|
2118
|
|
|
|
|
|
|
=cut |
2119
|
|
|
|
|
|
|
|
2120
|
|
|
|
|
|
|
=head2 sub_seconds |
2121
|
|
|
|
|
|
|
|
2122
|
|
|
|
|
|
|
sub_seconds(number $seconds) (Venus::Date) |
2123
|
|
|
|
|
|
|
|
2124
|
|
|
|
|
|
|
The sub_seconds method decrements the C attribute. |
2125
|
|
|
|
|
|
|
|
2126
|
|
|
|
|
|
|
I> |
2127
|
|
|
|
|
|
|
|
2128
|
|
|
|
|
|
|
=over 4 |
2129
|
|
|
|
|
|
|
|
2130
|
|
|
|
|
|
|
=item sub_seconds example 1 |
2131
|
|
|
|
|
|
|
|
2132
|
|
|
|
|
|
|
# given: synopsis; |
2133
|
|
|
|
|
|
|
|
2134
|
|
|
|
|
|
|
$date = $date->sub_seconds(1); |
2135
|
|
|
|
|
|
|
|
2136
|
|
|
|
|
|
|
# $date->string; # 1988-01-31T23:59:59Z |
2137
|
|
|
|
|
|
|
|
2138
|
|
|
|
|
|
|
# $date->epoch; # 570671999 |
2139
|
|
|
|
|
|
|
|
2140
|
|
|
|
|
|
|
=back |
2141
|
|
|
|
|
|
|
|
2142
|
|
|
|
|
|
|
=over 4 |
2143
|
|
|
|
|
|
|
|
2144
|
|
|
|
|
|
|
=item sub_seconds example 2 |
2145
|
|
|
|
|
|
|
|
2146
|
|
|
|
|
|
|
# given: synopsis; |
2147
|
|
|
|
|
|
|
|
2148
|
|
|
|
|
|
|
$date = $date->sub_seconds(61); |
2149
|
|
|
|
|
|
|
|
2150
|
|
|
|
|
|
|
# $date->string; # 1988-01-31T23:58:59Z |
2151
|
|
|
|
|
|
|
|
2152
|
|
|
|
|
|
|
# $date->epoch; # 570671939 |
2153
|
|
|
|
|
|
|
|
2154
|
|
|
|
|
|
|
=back |
2155
|
|
|
|
|
|
|
|
2156
|
|
|
|
|
|
|
=over 4 |
2157
|
|
|
|
|
|
|
|
2158
|
|
|
|
|
|
|
=item sub_seconds example 3 |
2159
|
|
|
|
|
|
|
|
2160
|
|
|
|
|
|
|
# given: synopsis; |
2161
|
|
|
|
|
|
|
|
2162
|
|
|
|
|
|
|
$date = $date->sub_seconds(-1); |
2163
|
|
|
|
|
|
|
|
2164
|
|
|
|
|
|
|
# $date->string; # 1988-02-01T00:00:01Z |
2165
|
|
|
|
|
|
|
|
2166
|
|
|
|
|
|
|
# $date->epoch; # 570672001 |
2167
|
|
|
|
|
|
|
|
2168
|
|
|
|
|
|
|
=back |
2169
|
|
|
|
|
|
|
|
2170
|
|
|
|
|
|
|
=cut |
2171
|
|
|
|
|
|
|
|
2172
|
|
|
|
|
|
|
=head2 sub_years |
2173
|
|
|
|
|
|
|
|
2174
|
|
|
|
|
|
|
sub_years(number $years) (Venus::Date) |
2175
|
|
|
|
|
|
|
|
2176
|
|
|
|
|
|
|
The sub_years method decrements the C attribute. |
2177
|
|
|
|
|
|
|
|
2178
|
|
|
|
|
|
|
I> |
2179
|
|
|
|
|
|
|
|
2180
|
|
|
|
|
|
|
=over 4 |
2181
|
|
|
|
|
|
|
|
2182
|
|
|
|
|
|
|
=item sub_years example 1 |
2183
|
|
|
|
|
|
|
|
2184
|
|
|
|
|
|
|
# given: synopsis; |
2185
|
|
|
|
|
|
|
|
2186
|
|
|
|
|
|
|
$date = $date->sub_years(1); |
2187
|
|
|
|
|
|
|
|
2188
|
|
|
|
|
|
|
# $date->string; # 1987-01-31T18:11:10Z |
2189
|
|
|
|
|
|
|
|
2190
|
|
|
|
|
|
|
# $date->epoch; # 539115070 |
2191
|
|
|
|
|
|
|
|
2192
|
|
|
|
|
|
|
=back |
2193
|
|
|
|
|
|
|
|
2194
|
|
|
|
|
|
|
=over 4 |
2195
|
|
|
|
|
|
|
|
2196
|
|
|
|
|
|
|
=item sub_years example 2 |
2197
|
|
|
|
|
|
|
|
2198
|
|
|
|
|
|
|
# given: synopsis; |
2199
|
|
|
|
|
|
|
|
2200
|
|
|
|
|
|
|
$date = $date->sub_years(25); |
2201
|
|
|
|
|
|
|
|
2202
|
|
|
|
|
|
|
# $date->string; # 1963-01-31T22:39:10Z |
2203
|
|
|
|
|
|
|
|
2204
|
|
|
|
|
|
|
# $date->epoch; # -218251250 |
2205
|
|
|
|
|
|
|
|
2206
|
|
|
|
|
|
|
=back |
2207
|
|
|
|
|
|
|
|
2208
|
|
|
|
|
|
|
=over 4 |
2209
|
|
|
|
|
|
|
|
2210
|
|
|
|
|
|
|
=item sub_years example 3 |
2211
|
|
|
|
|
|
|
|
2212
|
|
|
|
|
|
|
# given: synopsis; |
2213
|
|
|
|
|
|
|
|
2214
|
|
|
|
|
|
|
$date = $date->sub_years(-1); |
2215
|
|
|
|
|
|
|
|
2216
|
|
|
|
|
|
|
# $date->string; # 1989-01-31T05:48:50Z |
2217
|
|
|
|
|
|
|
|
2218
|
|
|
|
|
|
|
# $date->epoch; # 602228930 |
2219
|
|
|
|
|
|
|
|
2220
|
|
|
|
|
|
|
=back |
2221
|
|
|
|
|
|
|
|
2222
|
|
|
|
|
|
|
=cut |
2223
|
|
|
|
|
|
|
|
2224
|
|
|
|
|
|
|
=head1 OPERATORS |
2225
|
|
|
|
|
|
|
|
2226
|
|
|
|
|
|
|
This package overloads the following operators: |
2227
|
|
|
|
|
|
|
|
2228
|
|
|
|
|
|
|
=cut |
2229
|
|
|
|
|
|
|
|
2230
|
|
|
|
|
|
|
=over 4 |
2231
|
|
|
|
|
|
|
|
2232
|
|
|
|
|
|
|
=item operation: C<(!=)> |
2233
|
|
|
|
|
|
|
|
2234
|
|
|
|
|
|
|
This package overloads the C operator. |
2235
|
|
|
|
|
|
|
|
2236
|
|
|
|
|
|
|
B |
2237
|
|
|
|
|
|
|
|
2238
|
|
|
|
|
|
|
# given: synopsis; |
2239
|
|
|
|
|
|
|
|
2240
|
|
|
|
|
|
|
my $result = $date != 570672001; |
2241
|
|
|
|
|
|
|
|
2242
|
|
|
|
|
|
|
# 1 |
2243
|
|
|
|
|
|
|
|
2244
|
|
|
|
|
|
|
=back |
2245
|
|
|
|
|
|
|
|
2246
|
|
|
|
|
|
|
=over 4 |
2247
|
|
|
|
|
|
|
|
2248
|
|
|
|
|
|
|
=item operation: C<("")> |
2249
|
|
|
|
|
|
|
|
2250
|
|
|
|
|
|
|
This package overloads the C<""> operator. |
2251
|
|
|
|
|
|
|
|
2252
|
|
|
|
|
|
|
B |
2253
|
|
|
|
|
|
|
|
2254
|
|
|
|
|
|
|
# given: synopsis; |
2255
|
|
|
|
|
|
|
|
2256
|
|
|
|
|
|
|
my $result = "$date"; |
2257
|
|
|
|
|
|
|
|
2258
|
|
|
|
|
|
|
# "570672000" |
2259
|
|
|
|
|
|
|
|
2260
|
|
|
|
|
|
|
=back |
2261
|
|
|
|
|
|
|
|
2262
|
|
|
|
|
|
|
=over 4 |
2263
|
|
|
|
|
|
|
|
2264
|
|
|
|
|
|
|
=item operation: C<(+)> |
2265
|
|
|
|
|
|
|
|
2266
|
|
|
|
|
|
|
This package overloads the C<+> operator. |
2267
|
|
|
|
|
|
|
|
2268
|
|
|
|
|
|
|
B |
2269
|
|
|
|
|
|
|
|
2270
|
|
|
|
|
|
|
# given: synopsis; |
2271
|
|
|
|
|
|
|
|
2272
|
|
|
|
|
|
|
my $result = $date + 0; |
2273
|
|
|
|
|
|
|
|
2274
|
|
|
|
|
|
|
# 570672000 |
2275
|
|
|
|
|
|
|
|
2276
|
|
|
|
|
|
|
=back |
2277
|
|
|
|
|
|
|
|
2278
|
|
|
|
|
|
|
=over 4 |
2279
|
|
|
|
|
|
|
|
2280
|
|
|
|
|
|
|
=item operation: C<(-)> |
2281
|
|
|
|
|
|
|
|
2282
|
|
|
|
|
|
|
This package overloads the C<-> operator. |
2283
|
|
|
|
|
|
|
|
2284
|
|
|
|
|
|
|
B |
2285
|
|
|
|
|
|
|
|
2286
|
|
|
|
|
|
|
# given: synopsis; |
2287
|
|
|
|
|
|
|
|
2288
|
|
|
|
|
|
|
my $result = $date - 0; |
2289
|
|
|
|
|
|
|
|
2290
|
|
|
|
|
|
|
# 570672000 |
2291
|
|
|
|
|
|
|
|
2292
|
|
|
|
|
|
|
=back |
2293
|
|
|
|
|
|
|
|
2294
|
|
|
|
|
|
|
=over 4 |
2295
|
|
|
|
|
|
|
|
2296
|
|
|
|
|
|
|
=item operation: C<(0+)> |
2297
|
|
|
|
|
|
|
|
2298
|
|
|
|
|
|
|
This package overloads the C<0+> operator. |
2299
|
|
|
|
|
|
|
|
2300
|
|
|
|
|
|
|
B |
2301
|
|
|
|
|
|
|
|
2302
|
|
|
|
|
|
|
# given: synopsis; |
2303
|
|
|
|
|
|
|
|
2304
|
|
|
|
|
|
|
my $result = 0 + $date; |
2305
|
|
|
|
|
|
|
|
2306
|
|
|
|
|
|
|
# 570672000 |
2307
|
|
|
|
|
|
|
|
2308
|
|
|
|
|
|
|
=back |
2309
|
|
|
|
|
|
|
|
2310
|
|
|
|
|
|
|
=over 4 |
2311
|
|
|
|
|
|
|
|
2312
|
|
|
|
|
|
|
=item operation: C<(==)> |
2313
|
|
|
|
|
|
|
|
2314
|
|
|
|
|
|
|
This package overloads the C<==> operator. |
2315
|
|
|
|
|
|
|
|
2316
|
|
|
|
|
|
|
B |
2317
|
|
|
|
|
|
|
|
2318
|
|
|
|
|
|
|
# given: synopsis; |
2319
|
|
|
|
|
|
|
|
2320
|
|
|
|
|
|
|
my $result = $date == 570672000; |
2321
|
|
|
|
|
|
|
|
2322
|
|
|
|
|
|
|
# 1 |
2323
|
|
|
|
|
|
|
|
2324
|
|
|
|
|
|
|
=back |
2325
|
|
|
|
|
|
|
|
2326
|
|
|
|
|
|
|
=over 4 |
2327
|
|
|
|
|
|
|
|
2328
|
|
|
|
|
|
|
=item operation: C<(E)> |
2329
|
|
|
|
|
|
|
|
2330
|
|
|
|
|
|
|
This package overloads the C> operator. |
2331
|
|
|
|
|
|
|
|
2332
|
|
|
|
|
|
|
B |
2333
|
|
|
|
|
|
|
|
2334
|
|
|
|
|
|
|
# given: synopsis; |
2335
|
|
|
|
|
|
|
|
2336
|
|
|
|
|
|
|
my $result = $date > 570671999; |
2337
|
|
|
|
|
|
|
|
2338
|
|
|
|
|
|
|
# 1 |
2339
|
|
|
|
|
|
|
|
2340
|
|
|
|
|
|
|
=back |
2341
|
|
|
|
|
|
|
|
2342
|
|
|
|
|
|
|
=over 4 |
2343
|
|
|
|
|
|
|
|
2344
|
|
|
|
|
|
|
=item operation: C<(E=)> |
2345
|
|
|
|
|
|
|
|
2346
|
|
|
|
|
|
|
This package overloads the C=> operator. |
2347
|
|
|
|
|
|
|
|
2348
|
|
|
|
|
|
|
B |
2349
|
|
|
|
|
|
|
|
2350
|
|
|
|
|
|
|
# given: synopsis; |
2351
|
|
|
|
|
|
|
|
2352
|
|
|
|
|
|
|
my $result = $date >= 570672000; |
2353
|
|
|
|
|
|
|
|
2354
|
|
|
|
|
|
|
# 1 |
2355
|
|
|
|
|
|
|
|
2356
|
|
|
|
|
|
|
=back |
2357
|
|
|
|
|
|
|
|
2358
|
|
|
|
|
|
|
=over 4 |
2359
|
|
|
|
|
|
|
|
2360
|
|
|
|
|
|
|
=item operation: C<(E)> |
2361
|
|
|
|
|
|
|
|
2362
|
|
|
|
|
|
|
This package overloads the C> operator. |
2363
|
|
|
|
|
|
|
|
2364
|
|
|
|
|
|
|
B |
2365
|
|
|
|
|
|
|
|
2366
|
|
|
|
|
|
|
# given: synopsis; |
2367
|
|
|
|
|
|
|
|
2368
|
|
|
|
|
|
|
my $result = $date < 570672001; |
2369
|
|
|
|
|
|
|
|
2370
|
|
|
|
|
|
|
# 1 |
2371
|
|
|
|
|
|
|
|
2372
|
|
|
|
|
|
|
=back |
2373
|
|
|
|
|
|
|
|
2374
|
|
|
|
|
|
|
=over 4 |
2375
|
|
|
|
|
|
|
|
2376
|
|
|
|
|
|
|
=item operation: C<(E=)> |
2377
|
|
|
|
|
|
|
|
2378
|
|
|
|
|
|
|
This package overloads the C=> operator. |
2379
|
|
|
|
|
|
|
|
2380
|
|
|
|
|
|
|
B |
2381
|
|
|
|
|
|
|
|
2382
|
|
|
|
|
|
|
# given: synopsis; |
2383
|
|
|
|
|
|
|
|
2384
|
|
|
|
|
|
|
my $result = $date <= 570672000; |
2385
|
|
|
|
|
|
|
|
2386
|
|
|
|
|
|
|
# 1 |
2387
|
|
|
|
|
|
|
|
2388
|
|
|
|
|
|
|
=back |
2389
|
|
|
|
|
|
|
|
2390
|
|
|
|
|
|
|
=over 4 |
2391
|
|
|
|
|
|
|
|
2392
|
|
|
|
|
|
|
=item operation: C<(eq)> |
2393
|
|
|
|
|
|
|
|
2394
|
|
|
|
|
|
|
This package overloads the C operator. |
2395
|
|
|
|
|
|
|
|
2396
|
|
|
|
|
|
|
B |
2397
|
|
|
|
|
|
|
|
2398
|
|
|
|
|
|
|
# given: synopsis; |
2399
|
|
|
|
|
|
|
|
2400
|
|
|
|
|
|
|
my $result = $date eq '570672000'; |
2401
|
|
|
|
|
|
|
|
2402
|
|
|
|
|
|
|
# 1 |
2403
|
|
|
|
|
|
|
|
2404
|
|
|
|
|
|
|
=back |
2405
|
|
|
|
|
|
|
|
2406
|
|
|
|
|
|
|
=over 4 |
2407
|
|
|
|
|
|
|
|
2408
|
|
|
|
|
|
|
=item operation: C<(ne)> |
2409
|
|
|
|
|
|
|
|
2410
|
|
|
|
|
|
|
This package overloads the C operator. |
2411
|
|
|
|
|
|
|
|
2412
|
|
|
|
|
|
|
B |
2413
|
|
|
|
|
|
|
|
2414
|
|
|
|
|
|
|
# given: synopsis; |
2415
|
|
|
|
|
|
|
|
2416
|
|
|
|
|
|
|
my $result = $date ne '560672000'; |
2417
|
|
|
|
|
|
|
|
2418
|
|
|
|
|
|
|
# 1 |
2419
|
|
|
|
|
|
|
|
2420
|
|
|
|
|
|
|
=back |
2421
|
|
|
|
|
|
|
|
2422
|
|
|
|
|
|
|
=over 4 |
2423
|
|
|
|
|
|
|
|
2424
|
|
|
|
|
|
|
=item operation: C<(~~)> |
2425
|
|
|
|
|
|
|
|
2426
|
|
|
|
|
|
|
This package overloads the C<~~> operator. |
2427
|
|
|
|
|
|
|
|
2428
|
|
|
|
|
|
|
B |
2429
|
|
|
|
|
|
|
|
2430
|
|
|
|
|
|
|
# given: synopsis; |
2431
|
|
|
|
|
|
|
|
2432
|
|
|
|
|
|
|
my $result = $date ~~ '570672000'; |
2433
|
|
|
|
|
|
|
|
2434
|
|
|
|
|
|
|
# 1 |
2435
|
|
|
|
|
|
|
|
2436
|
|
|
|
|
|
|
=back |
2437
|
|
|
|
|
|
|
|
2438
|
|
|
|
|
|
|
=head1 AUTHORS |
2439
|
|
|
|
|
|
|
|
2440
|
|
|
|
|
|
|
Awncorp, C |
2441
|
|
|
|
|
|
|
|
2442
|
|
|
|
|
|
|
=cut |
2443
|
|
|
|
|
|
|
|
2444
|
|
|
|
|
|
|
=head1 LICENSE |
2445
|
|
|
|
|
|
|
|
2446
|
|
|
|
|
|
|
Copyright (C) 2000, Awncorp, C. |
2447
|
|
|
|
|
|
|
|
2448
|
|
|
|
|
|
|
This program is free software, you can redistribute it and/or modify it under |
2449
|
|
|
|
|
|
|
the terms of the Apache license version 2.0. |
2450
|
|
|
|
|
|
|
|
2451
|
|
|
|
|
|
|
=cut |