@@ -1327,6 +1327,8 @@ C<Numeric>.
1327
1327
1328
1328
method Version(Str:D: --> Version:D)
1329
1329
1330
+ Available as of the 2020.01 release of the Rakudo compiler.
1331
+
1330
1332
Coerces the string to L < Version|/type/Version > .
1331
1333
1332
1334
This could be used for L < type coercion in
@@ -1335,12 +1337,12 @@ signature|/language/signatures#Coercion_type>, as for example:
1335
1337
sub f(Version(Str) $want-version) { say $want-version.^name };
1336
1338
f "1.2.3"; # OUTPUT: «Version»
1337
1339
1338
- Available as of the 2020.01 release of the Rakudo compiler.
1339
-
1340
1340
= head2 method Date
1341
1341
1342
1342
method Date(Str:D:)
1343
1343
1344
+ Available as of the 2020.05 release of the Rakudo compiler.
1345
+
1344
1346
Coerces a C < Str > to a L « C « Date » |/type/Date» object, provided the string is
1345
1347
properly formatted. C « Date(Str) » also works.
1346
1348
@@ -1349,12 +1351,12 @@ Examples:
1349
1351
say '2015-11-24'.Date.year; # OUTPUT: «2015»
1350
1352
say Date('2015-11-24').year; # OUTPUT: «2015»
1351
1353
1352
- Available as of the 2020.05 release of the Rakudo compiler.
1353
-
1354
1354
= head2 method DateTime
1355
1355
1356
1356
method DateTime(Str:D:)
1357
1357
1358
+ Available as of the 2020.05 release of the Rakudo compiler.
1359
+
1358
1360
Coerces a C < Str > to a L « C « DateTime » |/type/DateTime» object, provided the
1359
1361
string is properly formatted. C « DateTime(Str) » also works.
1360
1362
@@ -1363,6 +1365,9 @@ Examples:
1363
1365
say ('2012-02-29T12:34:56Z').DateTime.hour; # OUTPUT: «12»
1364
1366
say DateTime('2012-02-29T12:34:56Z').hour; # OUTPUT: «12»
1365
1367
1366
- Available as of the 2020.05 release of the Rakudo compiler.
1368
+ Since Rakudo release 2022.07, it is also possible to just specify a
1369
+ "YYYY-MM-DD" string to indicate midnight on the given date.
1370
+
1371
+ say "2023-03-04".DateTime; # OUTPUT: «2023-03-04T00:00:00Z»
1367
1372
1368
1373
= end pod
0 commit comments