Initial upload version 0.7

This commit is contained in:
Sudhir Shenoy 2017-07-06 23:27:04 +09:00
parent d25c3d51ae
commit c306e8a033
11 changed files with 2015 additions and 0 deletions

78
packages.lisp Normal file
View file

@ -0,0 +1,78 @@
;;; Copyright (c) 2017, Sudhir Shenoy. All rights reserved.
;;; Redistribution and use in source and binary forms, with or without
;;; modification, are permitted provided that the following conditions
;;; are met:
;;; * Redistributions of source code must retain the above copyright
;;; notice, this list of conditions and the following disclaimer.
;;; * Redistributions in binary form must reproduce the above
;;; copyright notice, this list of conditions and the following
;;; disclaimer in the documentation and/or other materials
;;; provided with the distribution.
;;; THIS SOFTWARE IS PROVIDED BY THE AUTHOR 'AS IS' AND ANY EXPRESSED
;;; OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
;;; WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
;;; ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
;;; DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
;;; DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
;;; GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
;;; INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
;;; WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
;;; NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
;;; SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
(in-package :cl-user)
(defpackage :cl-dates
(:nicknames :dt)
(:use :common-lisp)
(:export
;; Make a new date
:ymd->date ; date from y/m/d/h/m/s components
:string->date ; date from string
:todays-date ; system date
:todays-datetime ; system date-time
;; Date converters
:date->ymd ; to components
:date->string ; to string
:date->long-string ; to string (verbose)
:date->javascript-time ; to JS datetime
:date->local-time ; to local time zone
:month->string ; full name of month
:dow->string ; day of week as string
;; Special dates for given year
:easter-day ; easter day
:vernal-equinox ; spring equinox date-time
:summer-solstice ; summer solstice date-time
:autumnal-equinox ; autumn equinox date-time
:winter-solstice ; winter solstice date-time
;; Miscellaneous functions
:valid-date-p
:valid-time-p
:jday-number ; Julian day number
:day-of-week ; Day of week for date
;; Comparisons
:date= :date/=
:date< :date<=
:date> :date>=
;; Calendar date arithmetic
:date+ :date- ; add/subtract days to date
:date-diff ; days between two dates
:nth-day-of-week ; 'n' weeks offset from start of month
:first-of-next-month ; first day of next month
:last-day-of-month ; last calendar day in month
:last-day-of-prev-month ; last calendar day in previous month
;; Business date arithmetic
;; :previous-workday ; last working day before date (which can be a holiday)
;; :next-workday ; next working day after date (which can be a holiday)
;; :bdate+ :bdate- ; add/subtract working days to date
;; :add-calendar-months ; add/subtract months obeying day count conventions
;; :add-months ; add/subtract months obeying day count conventions
;; :last-workday-of-month ; Last working day in month
;; :generate-date-series ; Series of coupon dates following day conventions
))