JanetDocsSourcePlaygroundTutorialsI'm Feeling luckyCommunityGitHub sign in
# due to 0 indexing, you will often want to add 1 to things: (defn short-date [d] (let [{:year y :month mon :month-day d} d] (string y "-" (+ 1 mon) "-" (+ 1 d)))) # Makes os/date like 2025-12-25 (short-date (os//date)) # From: https://codeberg.org/veqq/deforester/src/branch/master/deforester.janet (defn- time-string ``Gives current time as ISO 8601 string: https://en.wikipedia.org/wiki/ISO_8601 This accounts for `os/date` 0-indexing month and days which are 1-indexed in ISO 8601.`` [] (let [now (os/clock :realtime) ms (math/floor (* 1000 (mod now 1))) {:year y :month mon :month-day d :hours h :minutes min :seconds s} (os/date (math/floor now))] (string/format "%d-%02d-%02dT%02d:%02d:%02d.%03dZ" y (inc mon) (inc d) h min s ms)))