raku -e 'my $inst = now; put $inst, "\t", $inst.Int; put
DateTime.new($inst).local, "\t", DateTime.new($inst.Int).local,"\t",
DateTime.new($inst).local.truncated-to("second")'
Instant:1756479067.146121 1756479067
2025-08-29T09:50:30.146121-05:00 2025-08-29T09:51:07-05:00
2025-08-29T09:50:30-05:00

same 37 second difference

On Fri, Aug 29, 2025 at 9:23 AM Bruce Gray <robertbrucegr...@gmail.com>
wrote:

>
>
> On Aug 29, 2025, at 09:14, Mark Devine <m...@markdevine.com> wrote:
>
> Rakoons,
>
> --snip--
>
> In the end, I’m looking for elegant mechanics to get DateTime objects from
> multiple sources (including now), perform calculations, etc., then produce
> this format using .Str:
> YYYY-MM-DDT*HH:MM:SS*-04:00
> not this format:
> YYYY-MM-DDT*HH:MM:SS*.806520-04:00
>
>
>
> Hi Mark,
>
> This should work:
> raku -e 'say DateTime.now.truncated-to("second");'
> 2025-08-29T09:18:57-05:00
>
> Docs:
> https://docs.raku.org/type/DateTime#method_truncated-to
>
> --
> Hope this helps,
> Bruce Gray (Util of PerlMonks)
>


-- 

a

Andy Bach,
afb...@gmail.com
608 658-1890 cell
608 261-5738 wk

Reply via email to