diff options
| author | Mohammad S Anwar <Mohammad.Anwar@yahoo.com> | 2021-02-16 17:36:18 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-02-16 17:36:18 +0000 |
| commit | 6331e427a31d0e27cbdb761032377f296af729ba (patch) | |
| tree | 943788c9e167f81f6616f905a707ab53c28ab287 /challenge-100 | |
| parent | c02c0c436ebaf42c058d2080d118eb144880733e (diff) | |
| parent | e9853f8e34bf45f04de827b626cc774ae05b8c8f (diff) | |
| download | perlweeklychallenge-club-6331e427a31d0e27cbdb761032377f296af729ba.tar.gz perlweeklychallenge-club-6331e427a31d0e27cbdb761032377f296af729ba.tar.bz2 perlweeklychallenge-club-6331e427a31d0e27cbdb761032377f296af729ba.zip | |
Merge pull request #3544 from andemark/branch-for-challenge-100
initial ch-1.raku
Diffstat (limited to 'challenge-100')
| -rw-r--r-- | challenge-100/mark-anderson/raku/ch-1.raku | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/challenge-100/mark-anderson/raku/ch-1.raku b/challenge-100/mark-anderson/raku/ch-1.raku new file mode 100644 index 0000000000..3caea93879 --- /dev/null +++ b/challenge-100/mark-anderson/raku/ch-1.raku @@ -0,0 +1,28 @@ +#!/usr/bin/env raku + +use DateTime::Format; +use Time::Piece:from<Perl5>; +use Test; +plan 10; + +is fun-time("00:45"), "12:45 AM"; +is fun-time("01:45"), "01:45 AM"; +is fun-time("03:15"), "03:15 AM"; +is fun-time("13:45"), "01:45 PM"; +is fun-time("18:45"), "06:45 PM"; + +is fun-time("12:45 AM"), "00:45"; +is fun-time("01:45 AM"), "01:45"; +is fun-time("03:15 AM"), "03:15"; +is fun-time("01:45 PM"), "13:45"; +is fun-time("06:45 PM"), "18:45"; + +multi fun-time($T) +{ + strftime("%I:%M %p", DateTime.new("1970-01-01T$T:00Z")); +} + +multi fun-time($T where .ends-with("am"|"pm", :i)) +{ + Time::Piece.strptime($T, "%r").strftime("%R"); +} |
