Am new to clojure, can anyone help me to understand how can I get current date in clojure and then adding days to it? for e.g. adding 3 days to current date?
Using the DATE(year, month, day) function, e.g. =DATE(2015, 5, 6) + 10. As a result of another function. For example, to add a given number of days to the current date, use the TODAY() function: =TODAY()+10.
In cell C1, type =A1+30, and then press RETURN . This formula adds 30 days to the date in cell A1.
The mean length of its year is 365.25 days. To make it dividable into days we accept that three years in a row will have 365 days and the forth one, also called leap year, will have 366 days with one more day added to February. This is the calendar used in our calculator.
The idiomatic Clojure way is to use clj-time (see link for Leiningen/Maven install instructions), which wraps Joda time as referenced by the first answer from overthink.
user=> (use '[clj-time.core])
nil
user=> (now)
#<DateTime 2014-11-25T12:03:34.714Z>
user=> (plus (now) (days 3))
#<DateTime 2014-11-28T12:05:40.888Z>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With