date functions added
This commit is contained in:
@@ -135,6 +135,16 @@
|
||||
(quick-sort-by l (lambda (a b) (> a b))))
|
||||
|
||||
|
||||
(defun start-of-day (datetime) (str-to-date (+ (date-to-str datetime "%Y-%m-%d") " " "00:00:00") "%Y-%m-%d %H:%M:%S"))
|
||||
(defun end-of-day (datetime) (str-to-date (+ (date-to-str datetime "%Y-%m-%d") " " "23:59:59") "%Y-%m-%d %H:%M:%S"))
|
||||
(defun start-of-month (datetime) (str-to-date (+ (date-to-str datetime "%Y-%m") "-01 00:00:00") "%Y-%m-%d %H:%M:%S"))
|
||||
(defun start-of-next-month (datetime) (date-add (start-of-month datetime) 1 "month"))
|
||||
(defun end-of-next-month (datetime) (date-add (end-of-month datetime) 1 "month"))
|
||||
(defun end-of-month (datetime) (date-add (date-add (start-of-month datetime) 1 "month") -1 "second"))
|
||||
(defun start-of-prev-month (datetime) (date-add (start-of-month datetime) -1 "month"))
|
||||
(defun end-of-prev-month (datetime) (date-add (end-of-month datetime) -1 "month"))
|
||||
(defun start-of-year (datetime) (str-to-date (+ (date-to-str datetime "%Y") "-01-01 00:00:00") "%Y-%m-%d %H:%M:%S"))
|
||||
(defun end-of-year (datetime) (str-to-date (+ (date-to-str datetime "%Y") "-12-31 23:59:59") "%Y-%m-%d %H:%M:%S"))
|
||||
|
||||
|
||||
; from list of lists creates csv string
|
||||
|
||||
Reference in New Issue
Block a user