Date without time, or swap time and date locations in $now


#1

I have several pistons with piston states. Rather than showing “Mon, Apr 26 2021 @ 9:00:00 PM PDT”, I’d like to say “at 6:05:00 AM on Mon, Apr 26 2021” (or, even better, the shorter “Mon, 4/27/2021”.)

What would be the easiest way to parse such a line? I’ve considered using “At {$time} on {$now}” and using REPLACE to remove the duplicative time from the $now variable, but just seeing if there’s a better way.


#2

formatDateTime($now, "E, M/dd/YYYY")
(expression) formatDateTime($now, "E, M/dd/YYYY") »»» (string) Tue, 4/27/2021

Formatting details: https://wiki.webcore.co/Functions#formatDateTime