Skip to content

Commit cc53cff

Browse files
committed
DateTime: some timezone related methods
1 parent 7dafe3e commit cc53cff

File tree

1 file changed

+20
-3
lines changed

1 file changed

+20
-3
lines changed

lib/Type/DateTime.pod

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ It provides methods for calculating with date and time.
1515
C<DateTime> methods are immutable; if you are tempted to modify one, create a
1616
modified copy instead.
1717
18-
Time zones are handled as L<Integers|/type/Int> in B<seconds> offset from UTC.
18+
Time zones are handled as L<Integers|/type/Int> in B<seconds> offset from UTC,
19+
not by time zone name.
1920
2021
=head1 Methods
2122
@@ -161,10 +162,26 @@ C<.truncated-to('second')>.
161162
162163
Returns a L<Date|/type/Date> object for this datetime object.
163164
165+
=head2 method utc
166+
167+
method utc() returns DateTime:D
168+
169+
Returns a DateTime object for the same time, but in time zone UTC.
170+
171+
say DateTime.new('2015-12-24T12:23:00+0200').utc"; # 2015-12-24T10:23:00Z
172+
173+
=head2 method in-timezone
174+
175+
method in-timezone($timezone = 0) returns DateTime:D
176+
177+
Returns a DateTime object for the same time, but in the specified time zone.
178+
179+
say DateTime.new('2015-12-24T12:23:00Z').in-timezone(3600 + 1800);
180+
# 2015-12-24T13:53:00+0130
181+
164182
=begin comment
165183
166-
TODO: offset, offset-in-minutes, offset-in-hours, whole-second, in-timezone,
167-
utc, local, Str
184+
TODO: offset, offset-in-minutes, offset-in-hours, whole-second, local, Str
168185
169186
=end comment
170187

0 commit comments

Comments
 (0)