The date-calc Reference Manual

This is the date-calc Reference Manual, version 0.2, generated automatically by Declt version 4.0 beta 2 "William Riker" on Sun Sep 15 05:00:01 2024 GMT+0.

Table of Contents


1 Introduction


2 Systems

The main system appears first, followed by any subsystem dependency.


2.1 date-calc

Package for simple date calculation

Maintainer

Paul M. Rodriguez <>

Author

Heiko Schröter <>

License

GPL or Artistic

Version

0.2

Source

date-calc.asd.

Child Component

date-calc.lisp (file).


3 Files

Files are sorted by type and then listed depth-first from the systems components trees.


3.1 Lisp


3.1.1 date-calc/date-calc.asd

Source

date-calc.asd.

Parent Component

date-calc (system).

ASDF Systems

date-calc.


3.1.2 date-calc/date-calc.lisp

Source

date-calc.asd.

Parent Component

date-calc (system).

Packages

date-calc.

Public Interface
Internals

4 Packages

Packages are listed by definition order.


4.1 date-calc

Source

date-calc.lisp.

Use List

common-lisp.

Public Interface
Internals

5 Definitions

Definitions are sorted by export status, category, package, and then by lexicographic order.


5.1 Public Interface


5.1.1 Special variables

Special Variable: *language*
Package

date-calc.

Source

date-calc.lisp.


5.1.2 Ordinary functions

Function: add-delta-days (year month day delta)

This function returns (values year month day) such that it is YEAR MONTH DAY plus DELTA days

Package

date-calc.

Source

date-calc.lisp.

Function: add-delta-dhms (year month day hour min sec dd dh dm ds)

This function serves to add a days, hours, minutes and seconds offset to a given date and time (YEAR MONTH DAY HOUR MINUTE SECOND DDAY DHOUR DMINUTE DSECOND), in order to answer questions like "today and now plus 7 days but minus 5 hours and then plus 30 minutes, what date and time gives that?". Returns: (values y m d h min sec)

Package

date-calc.

Source

date-calc.lisp.

Function: add-delta-ym (year month day dy dm)

This function adds DYEAR and DMONTH offset to YEAR MONTH DAY.

Package

date-calc.

Source

date-calc.lisp.

Function: add-delta-ymd (year month day dy dm dd)

This function adds DYEAR DMONTH and DDAY offset to YEAR MONTH DAY.

Package

date-calc.

Source

date-calc.lisp.

Function: add-delta-ymdhms (year month day hour min sec dyear dmonth dday dh dm ds)

This function is the same as add-delta-ymd except that a time offset may be given in addition to the year, month and day offset

Package

date-calc.

Source

date-calc.lisp.

Function: add-year-month (year month dy dm)

This function adds DYEAR and DMONTH offset to YEAR and MONTH.

Package

date-calc.

Source

date-calc.lisp.

Function: business-to-standard (year week dow)

This function converts a given date from business notation YEAR WEEK DOW to standard notation year month day. DOW is not CL conform.

Package

date-calc.

Source

date-calc.lisp.

Function: center (string width)

Return a string that is WIDTH long with STRING centered in it.

Package

date-calc.

Source

date-calc.lisp.

Function: check-business-p (year week dow)

This function returns true if the given three numerical values YEAR WEEK DOW constitute a valid date in business format, and nil otherwise. Beware that this function does NOT compute whether a given date is a business day (i.e., Monday to Friday)! To do so, use (< (day-of-week year month day) 6) instead. DOW not CL conform.

Package

date-calc.

Source

date-calc.lisp.

Function: check-date (year month day)

This function returns t if the given three numerical values YEAR MONTH DAY constitute a valid date, and nil otherwise.

Package

date-calc.

Source

date-calc.lisp.

Function: check-time-p (hour min sec)

This function returns t if the given three numerical values HOUR MIN SEC constitute a valid time, and nil otherwise.

Package

date-calc.

Source

date-calc.lisp.

Function: cl-business-to-standard (year week dow)

This function converts a given date from business notation YEAR WEEK DOW to standard notation year month day. DOW is CL conform.

Package

date-calc.

Source

date-calc.lisp.

Function: cl-check-business-p (year week dow)

This function returns true if the given three numerical values YEAR WEEK DOW constitute a valid date in business format for CL (Monday=0), and nil otherwise. DOW is CL conform.

Package

date-calc.

Source

date-calc.lisp.

Function: cl-day-of-week (year month day)

This function returns the DOW of YEAR MONTH DAY. DOW CL conform.

Package

date-calc.

Source

date-calc.lisp.

Function: cl-decode-day-of-week (str)

Returns number of weekday. STR can partially name the Weekday. DOW is CL conform.

Package

date-calc.

Source

date-calc.lisp.

Function: cl-nth-weekday-of-month-year (year month dow n)

This function returns the (year month day) of the N-th day of week DOW in the given MONTH and YEAR; such as, for example, the 3rd Thursday of a given month and year. DOW is CL conform.

Package

date-calc.

Source

date-calc.lisp.

Function: cl-standard-to-business (year month day)

This function converts a given date from standard notation YEAR MONTH DAY to business notation year week day of week. DOW is CL conform.

Package

date-calc.

Source

date-calc.lisp.

Function: cl-system-clock (gmt time)

This function returns (values year month day hour min sec doy dow dst) based on current system clock. DOW is CL conform.

Package

date-calc.

Source

date-calc.lisp.

Function: cl-weeks-in-year (year)

This function returns the number of weeks in the given YEAR for CL DOW conform numbering (Monday=0)., i.e., either 52 or 53.

Package

date-calc.

Source

date-calc.lisp.

Function: date-to-days (year month day)

This function returns the (absolute) number of the day of the given date, where counting starts at the 1.Jan 1.

Package

date-calc.

Source

date-calc.lisp.

Function: date-to-text (year month day)

Return a pretty print string of YEAR MONTH DAY in DOW-TXT(SHORT) DAY MONTH YEAR with a little bit of sorting for language.

Package

date-calc.

Source

date-calc.lisp.

Function: date-to-text-long (year month day)

Return a pretty print string of YEAR MONTH DAY in DOW-TXT(LONG) DAY MONTH YEAR with a little bit of sorting for language.

Package

date-calc.

Source

date-calc.lisp.

Function: day-of-week (year month day)

This function returns the DOW of YEAR MONTH DAY. DOW not CL conform.

Package

date-calc.

Source

date-calc.lisp.

Function: day-of-year (year month day)

This function returns the sum of the number of days in the months starting with January up to and including MONTH in the given year YEAR. 0 on failure.

Package

date-calc.

Source

date-calc.lisp.

Function: days-in-month (year month)

This function returns the number of days in the given MONTH of the given YEAR.

Package

date-calc.

Source

date-calc.lisp.

Function: days-in-year (year &optional month)

This function returns the number of days in the given YEAR and optional MONTH. If MONTH is [1..12], return the number of days in that YEAR as of the last of that MONTH.

Package

date-calc.

Source

date-calc.lisp.

Function: decode-day-of-week (str)

Returns number of weekday. STR can partially name the Weekday. DOW is not CL conform.

Package

date-calc.

Source

date-calc.lisp.

Function: decode-language (num)

Returns the Language of number NUM.

Package

date-calc.

Source

date-calc.lisp.

Function: decode-month (str)

Returns number of month. STR can partially name the month. Computes a (search ...:test #’char-equal).

Package

date-calc.

Source

date-calc.lisp.

Function: delta-days (year1 month1 day1 year2 month2 day2)

This function returns the difference in days between Y1 M1 D1 and Y2 M2 D2.

Package

date-calc.

Source

date-calc.lisp.

Function: delta-dhms (year1 month1 day1 hour1 min1 sec1 year2 month2 day2 hour2 min2 sec2)

Returns the difference in (values d h m s) between the two given dates with times (Y1 M1 D1 H1 MIN1 SEC1 and Y2 M2 D2 H2 MIN2 SEC2).

Package

date-calc.

Source

date-calc.lisp.

Function: delta-hms (hour1 min1 sec1 hour2 min2 sec2)

This function returns the difference of H1 M1 S1 and H2 M2 S2 in (values d h m s).

Package

date-calc.

Source

date-calc.lisp.

Function: delta-ymd (year1 month1 day1 year2 month2 day2)

This function returns the difference (values YEAR MONTH DAYS) between the two dates Y1M1D1 and Y2M2D2.

Package

date-calc.

Source

date-calc.lisp.

Function: delta-ymdhms (year1 month1 day1 hour1 min1 sec1 year2 month2 day2 hour2 min2 sec2)

This function returns the difference (values YEAR MONTH DAYS HOUR MINUTE SEC) between the two dates Y1 M1 D1 H1 MI1 S1 and Y2 M2 D2 H2 MI2 S2.

Package

date-calc.

Source

date-calc.lisp.

Function: fixed-window (year)

Convert two digit YEAR to four digit YEAR; YEAR<=70 -> 2000+YEAR; YEAR<100&&>70 -> 1900+YEAR.

Package

date-calc.

Source

date-calc.lisp.

Function: gmtime ()
Package

date-calc.

Source

date-calc.lisp.

Function: iso-lc (char)

Returns lower case CHAR.

Package

date-calc.

Source

date-calc.lisp.

Function: iso-uc (char)

Returns upper case CHAR.

Package

date-calc.

Source

date-calc.lisp.

Function: leap-year (year)

This function returns 1 if the given YEAR is a leap year and 0 otherwise.

Package

date-calc.

Source

date-calc.lisp.

Function: leap-year-p (year)

This function returns t if the given YEAR is a leap year and nil otherwise.

Package

date-calc.

Source

date-calc.lisp.

Function: localtime ()
Package

date-calc.

Source

date-calc.lisp.

Function: monday-of-week (week year)

Return (values year month day) where month and day correspond to the Monday of WEEK in YEAR

Package

date-calc.

Source

date-calc.lisp.

Function: normalize-dhms (day hour min sec)

This function takes four arbitrary values for days, hours, minutes and seconds (which may have different signs) and renormalizes them so that the values for hours, minutes and seconds will lie in the ranges [-23..23], [-59..59] and [-59..59], respectively, and so that they have the same sign.

Package

date-calc.

Source

date-calc.lisp.

Function: now ()

This function returns (hour minute second) for right now.

Package

date-calc.

Source

date-calc.lisp.

Function: nth-weekday-of-month-year (year month dow n)

This function returns the (year month day) of the N-th day of week DOW in the given MONTH and YEAR; such as, for example, the 3rd Thursday of a given month and year. DOW is not CL conform.

Package

date-calc.

Source

date-calc.lisp.

Function: standard-to-business (year month day)

This function converts a given date from standard notation YEAR MONTH DAY to business notation year week dow. DOW is not CL conform.

Package

date-calc.

Source

date-calc.lisp.

Function: system-clock (gmt time)

This function returns (values year month day hour min sec doy dow dst) based on current system clock. DOW is not CL conform.

Package

date-calc.

Source

date-calc.lisp.

Function: this-year ()

This function returns the current year in localtime.

Package

date-calc.

Source

date-calc.lisp.

Function: today ()

This function returns (year month day) for today.

Package

date-calc.

Source

date-calc.lisp.

Function: today-and-now ()

This function returns (year month day hour minute second) for the current date and time.

Package

date-calc.

Source

date-calc.lisp.

Function: tomorrow ()
Package

date-calc.

Source

date-calc.lisp.

Function: valid-month-p (month)
Package

date-calc.

Source

date-calc.lisp.

Function: valid-year-p (year)
Package

date-calc.

Source

date-calc.lisp.

Function: week-number (year month day)

This function returns the number of the week of the given Y M D lies in. If the given date lies in the LAST week of the PREVIOUS year, 0 is returned.

Package

date-calc.

Source

date-calc.lisp.

Function: week-of-year (year month day)

Return (values week year) where week is the week number of YEAR

Package

date-calc.

Source

date-calc.lisp.

Function: weeks-in-year (year)

This function returns the number of weeks in the given YEAR, i.e., either 52 or 53.

Package

date-calc.

Source

date-calc.lisp.

Function: year-to-days (year)

Returns the number of days for YEAR since 1 Jan 1.

Package

date-calc.

Source

date-calc.lisp.

Function: yesterday ()
Package

date-calc.

Source

date-calc.lisp.


5.2 Internals


5.2.1 Special variables

Special Variable: century-of-epoc

Century of reference (epoc)

Package

date-calc.

Source

date-calc.lisp.

Special Variable: day-of-week-abbreviation
Package

date-calc.

Source

date-calc.lisp.

Special Variable: days-in-month-arr
Package

date-calc.

Source

date-calc.lisp.

Special Variable: days-in-year-arr
Package

date-calc.

Source

date-calc.lisp.

Special Variable: epoc

reference year (epoc)

Package

date-calc.

Source

date-calc.lisp.

Special Variable: language-to-text
Package

date-calc.

Source

date-calc.lisp.

Special Variable: languages
Package

date-calc.

Source

date-calc.lisp.

Special Variable: long-format
Package

date-calc.

Source

date-calc.lisp.

Special Variable: month-to-text
Package

date-calc.

Source

date-calc.lisp.

Special Variable: year-of-epoc

Year of reference (epoc)

Package

date-calc.

Source

date-calc.lisp.


5.2.2 Ordinary functions

Function: day-of-week-to-text (n)
Package

date-calc.

Source

date-calc.lisp.

Function: normalize-ranges (dd dh dm ds)

Internal fn for normalize-dhms. Returns the normalized (values DD DH DM DS). This function prevents overflow errors on systems with short longs (e.g. 32-bits) (If need be for CL ???).

Package

date-calc.

Source

date-calc.lisp.

Function: normalize-signs (dd dh dm ds)

Internal fn for normalize-dhms.

Package

date-calc.

Source

date-calc.lisp.

Function: normalize-time (dd dh dm ds)

Internal fn for normalize-dhms. Returns the normalized (values DD DH DM DS).

Package

date-calc.

Source

date-calc.lisp.


Appendix A Indexes


A.1 Concepts


A.2 Functions

Jump to:   A   B   C   D   F   G   I   L   M   N   S   T   V   W   Y  
Index Entry  Section

A
add-delta-days: Public ordinary functions
add-delta-dhms: Public ordinary functions
add-delta-ym: Public ordinary functions
add-delta-ymd: Public ordinary functions
add-delta-ymdhms: Public ordinary functions
add-year-month: Public ordinary functions

B
business-to-standard: Public ordinary functions

C
center: Public ordinary functions
check-business-p: Public ordinary functions
check-date: Public ordinary functions
check-time-p: Public ordinary functions
cl-business-to-standard: Public ordinary functions
cl-check-business-p: Public ordinary functions
cl-day-of-week: Public ordinary functions
cl-decode-day-of-week: Public ordinary functions
cl-nth-weekday-of-month-year: Public ordinary functions
cl-standard-to-business: Public ordinary functions
cl-system-clock: Public ordinary functions
cl-weeks-in-year: Public ordinary functions

D
date-to-days: Public ordinary functions
date-to-text: Public ordinary functions
date-to-text-long: Public ordinary functions
day-of-week: Public ordinary functions
day-of-week-to-text: Private ordinary functions
day-of-year: Public ordinary functions
days-in-month: Public ordinary functions
days-in-year: Public ordinary functions
decode-day-of-week: Public ordinary functions
decode-language: Public ordinary functions
decode-month: Public ordinary functions
delta-days: Public ordinary functions
delta-dhms: Public ordinary functions
delta-hms: Public ordinary functions
delta-ymd: Public ordinary functions
delta-ymdhms: Public ordinary functions

F
fixed-window: Public ordinary functions
Function, add-delta-days: Public ordinary functions
Function, add-delta-dhms: Public ordinary functions
Function, add-delta-ym: Public ordinary functions
Function, add-delta-ymd: Public ordinary functions
Function, add-delta-ymdhms: Public ordinary functions
Function, add-year-month: Public ordinary functions
Function, business-to-standard: Public ordinary functions
Function, center: Public ordinary functions
Function, check-business-p: Public ordinary functions
Function, check-date: Public ordinary functions
Function, check-time-p: Public ordinary functions
Function, cl-business-to-standard: Public ordinary functions
Function, cl-check-business-p: Public ordinary functions
Function, cl-day-of-week: Public ordinary functions
Function, cl-decode-day-of-week: Public ordinary functions
Function, cl-nth-weekday-of-month-year: Public ordinary functions
Function, cl-standard-to-business: Public ordinary functions
Function, cl-system-clock: Public ordinary functions
Function, cl-weeks-in-year: Public ordinary functions
Function, date-to-days: Public ordinary functions
Function, date-to-text: Public ordinary functions
Function, date-to-text-long: Public ordinary functions
Function, day-of-week: Public ordinary functions
Function, day-of-week-to-text: Private ordinary functions
Function, day-of-year: Public ordinary functions
Function, days-in-month: Public ordinary functions
Function, days-in-year: Public ordinary functions
Function, decode-day-of-week: Public ordinary functions
Function, decode-language: Public ordinary functions
Function, decode-month: Public ordinary functions
Function, delta-days: Public ordinary functions
Function, delta-dhms: Public ordinary functions
Function, delta-hms: Public ordinary functions
Function, delta-ymd: Public ordinary functions
Function, delta-ymdhms: Public ordinary functions
Function, fixed-window: Public ordinary functions
Function, gmtime: Public ordinary functions
Function, iso-lc: Public ordinary functions
Function, iso-uc: Public ordinary functions
Function, leap-year: Public ordinary functions
Function, leap-year-p: Public ordinary functions
Function, localtime: Public ordinary functions
Function, monday-of-week: Public ordinary functions
Function, normalize-dhms: Public ordinary functions
Function, normalize-ranges: Private ordinary functions
Function, normalize-signs: Private ordinary functions
Function, normalize-time: Private ordinary functions
Function, now: Public ordinary functions
Function, nth-weekday-of-month-year: Public ordinary functions
Function, standard-to-business: Public ordinary functions
Function, system-clock: Public ordinary functions
Function, this-year: Public ordinary functions
Function, today: Public ordinary functions
Function, today-and-now: Public ordinary functions
Function, tomorrow: Public ordinary functions
Function, valid-month-p: Public ordinary functions
Function, valid-year-p: Public ordinary functions
Function, week-number: Public ordinary functions
Function, week-of-year: Public ordinary functions
Function, weeks-in-year: Public ordinary functions
Function, year-to-days: Public ordinary functions
Function, yesterday: Public ordinary functions

G
gmtime: Public ordinary functions

I
iso-lc: Public ordinary functions
iso-uc: Public ordinary functions

L
leap-year: Public ordinary functions
leap-year-p: Public ordinary functions
localtime: Public ordinary functions

M
monday-of-week: Public ordinary functions

N
normalize-dhms: Public ordinary functions
normalize-ranges: Private ordinary functions
normalize-signs: Private ordinary functions
normalize-time: Private ordinary functions
now: Public ordinary functions
nth-weekday-of-month-year: Public ordinary functions

S
standard-to-business: Public ordinary functions
system-clock: Public ordinary functions

T
this-year: Public ordinary functions
today: Public ordinary functions
today-and-now: Public ordinary functions
tomorrow: Public ordinary functions

V
valid-month-p: Public ordinary functions
valid-year-p: Public ordinary functions

W
week-number: Public ordinary functions
week-of-year: Public ordinary functions
weeks-in-year: Public ordinary functions

Y
year-to-days: Public ordinary functions
yesterday: Public ordinary functions