JanetDocsI'm feeling luckyGithub sign in

os/date



    cfunction

    (os/date &opt time local)
    
    Returns the given time as a date struct, or the current time if no
    time is given. Returns a struct with following key values. Note that
    all numbers are 0-indexed. Date is given in UTC unless local is truthy,
    in which case the date is formatted for the local timezone.
    
      :seconds - number of seconds [0-61]
      :minutes - number of minutes [0-59]
      :hours - number of hours [0-23]
      :month-day - day of month [0-30]
      :month - month of year [0, 11]
      :year - years since year 0 (e.g. 2019)
      :week-day - day of the week [0-6]
      :year-day - day of the year [0-365]
      :dst - If Day Light Savings is in effect


2 examplesSign in to add an example
Loading...
(os/date)
# => {:month 6 :dst false :year-day 185 :seconds 38 :minutes 44 :week-day 6 :year 2020 :hours 4 :month-day 3}
cellularmitosis
(def time (os/time))  # => 1593838001

(os/date t)
# => {:month 6 :dst false :year-day 185 :seconds 41 :minutes 46 :week-day 6 :year 2020 :hours 4 :month-day 3}
(os/date t false)
# => {:month 6 :dst false :year-day 185 :seconds 41 :minutes 46 :week-day 6 :year 2020 :hours 4 :month-day 3}

(os/date t true)
# => {:month 6 :dst true :year-day 184 :seconds 41 :minutes 46 :week-day 5 :year 2020 :hours 23 :month-day 2}
(os/date t :local)
# => {:month 6 :dst true :year-day 184 :seconds 41 :minutes 46 :week-day 5 :year 2020 :hours 23 :month-day 2}
cellularmitosis