time.Parse builds a time from a layout and a string, and returns the time plus an error. Format prints one. Layouts use Go's reference time, shown on the formatting page. Weekday and Year are methods.
time.Parse
Format
Weekday
Year
(let [[tm err] (time.Parse time.RFC3339 "2024-03-05T15:04:05Z")] (println (nil? err)) (println (.Format (.UTC tm) "2006-01-02 15:04:05")) (println (str (.Weekday tm))) (println (.Year tm)))
time.Now is the current time. Comparing its Unix second to zero shows that the clock is readable without baking today's date into the output.
time.Now
(println (pos? (.Unix (time.Now))))
The parsed instant is in March 2024.
$ glj time.glj true 2024-03-05 15:04:05 Tuesday 2024 true
Next example: Epoch.
A hands-on tour in the style of Go by Example. Glojure is a Clojure interpreter hosted on Go.