Date format: Difference between revisions
Content added Content deleted
(→{{header|Raku}}: switch to Date for libraryless example) |
(→{{header|Raku}}: Whither October?!) |
||
Line 2,694: | Line 2,694: | ||
They don't include the longer format specified in the task, but you can always roll your own formatter instead of importing the library: |
They don't include the longer format specified in the task, but you can always roll your own formatter instead of importing the library: |
||
<lang perl6>my @months = <January February March April May June |
<lang perl6>my @months = <January February March April May June July |
||
August September October November December>; |
|||
my @days = <Sunday Monday Tuesday Wednesday Thursday Friday Saturday>; |
my @days = <Sunday Monday Tuesday Wednesday Thursday Friday Saturday>; |
||
my $us-long = sub ($self) { "{@days[$self.day-of-week]}, {@months[$self.month-1]} {$self.day}, {$self.year}" }; |
my $us-long = sub ($self) { "{@days[$self.day-of-week]}, {@months[$self.month - 1]} {$self.day}, {$self.year}" }; |
||
my $d = Date.today :formatter($us-long); |
my $d = Date.today :formatter($us-long); |
||