From e3d7a57ee338b39d2d871ab8da7a784497d4b47d Mon Sep 17 00:00:00 2001 From: Andinus Date: Mon, 16 Aug 2021 18:12:11 +0530 Subject: Add timestamp-to-date subroutine, module Timestamp It returns Date object of given stamp. --- lib/Taurus/Timestamp.rakumod | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 lib/Taurus/Timestamp.rakumod (limited to 'lib/Taurus') diff --git a/lib/Taurus/Timestamp.rakumod b/lib/Taurus/Timestamp.rakumod new file mode 100644 index 0000000..e9013bc --- /dev/null +++ b/lib/Taurus/Timestamp.rakumod @@ -0,0 +1,7 @@ +unit module Taurus::Timestamp; + +sub timestamp-to-date(Str $stamp --> Date) is export { + Date.new( + "%s-%s-%s".sprintf(.substr(6, 4), .substr(3, 2), .substr(0, 2)) + ) with $stamp; +} -- cgit 1.4.1-2-gfad0