The date-calc Reference Manual

Table of Contents

Next: , Previous: , Up: (dir)   [Contents][Index]

The date-calc Reference Manual

This is the date-calc Reference Manual, version 0.2, generated automatically by Declt version 3.0 "Montgomery Scott" on Mon Dec 02 10:06:37 2019 GMT+0.


Next: , Previous: , Up: Top   [Contents][Index]

1 Introduction

Date-Calc

This is a fork of Heiko Schröter’s Date-Calc library, a port of Perl’s Date::Calc library.

The original was dropped from Quicklisp, but I still use it, so I’m keeping it on life sup


Next: , Previous: , Up: Top   [Contents][Index]

2 Systems

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


Previous: , Up: Systems   [Contents][Index]

2.1 date-calc

Maintainer

Paul M. Rodriguez <pmr@ruricolist.com>

Author

Heiko Schröter <schroete@iup.physik.uni-bremen.de>

License

GPL or Artistic

Description

Package for simple date calculation

Version

0.2

Source

date-calc.asd (file)

Component

date-calc.lisp (file)


Next: , Previous: , Up: Top   [Contents][Index]

3 Files

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


Previous: , Up: Files   [Contents][Index]

3.1 Lisp


Next: , Previous: , Up: Lisp files   [Contents][Index]

3.1.1 date-calc.asd

Location

date-calc.asd

Systems

date-calc (system)


Previous: , Up: Lisp files   [Contents][Index]

3.1.2 date-calc/date-calc.lisp

Parent

date-calc (system)

Location

date-calc.lisp

Packages

date-calc

Exported Definitions
Internal Definitions

Next: , Previous: , Up: Top   [Contents][Index]

4 Packages

Packages are listed by definition order.


Previous: , Up: Packages   [Contents][Index]

4.1 date-calc

Source

date-calc.lisp (file)

Use List

common-lisp

Exported Definitions
Internal Definitions

Next: , Previous: , Up: Top   [Contents][Index]

5 Definitions

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


Next: , Previous: , Up: Definitions   [Contents][Index]

5.1 Exported definitions


Next: , Previous: , Up: Exported definitions   [Contents][Index]

5.1.1 Special variables

Special Variable: *language*
Package

date-calc

Source

date-calc.lisp (file)


Previous: , Up: Exported definitions   [Contents][Index]

5.1.2 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 (file)

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 (file)

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 (file)

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 (file)

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 (file)

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 (file)

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 (file)

Function: center STRING WIDTH

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

Package

date-calc

Source

date-calc.lisp (file)

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 (file)

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 (file)

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 (file)

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 (file)

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 (file)

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 (file)

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 (file)

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 (file)

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 (file)

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 (file)

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 (file)

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 (file)

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 (file)

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 (file)

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 (file)

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 (file)

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 (file)

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 (file)

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 (file)

Function: decode-language NUM

Returns the Language of number NUM.

Package

date-calc

Source

date-calc.lisp (file)

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 (file)

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 (file)

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 (file)

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 (file)

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 (file)

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 (file)

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 (file)

Function: gmtime ()
Package

date-calc

Source

date-calc.lisp (file)

Function: iso-lc CHAR

Returns lower case CHAR.

Package

date-calc

Source

date-calc.lisp (file)

Function: iso-uc CHAR

Returns upper case CHAR.

Package

date-calc

Source

date-calc.lisp (file)

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 (file)

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 (file)

Function: localtime ()
Package

date-calc

Source

date-calc.lisp (file)

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 (file)

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 (file)

Function: now ()

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

Package

date-calc

Source

date-calc.lisp (file)

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 (file)

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 (file)

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 (file)

Function: this-year ()

This function returns the current year in localtime.

Package

date-calc

Source

date-calc.lisp (file)

Function: today ()

This function returns (year month day) for today.

Package

date-calc

Source

date-calc.lisp (file)

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 (file)

Function: tomorrow ()
Package

date-calc

Source

date-calc.lisp (file)

Function: valid-month-p MONTH
Package

date-calc

Source

date-calc.lisp (file)

Function: valid-year-p YEAR
Package

date-calc

Source

date-calc.lisp (file)

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 (file)

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 (file)

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 (file)

Function: year-to-days YEAR

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

Package

date-calc

Source

date-calc.lisp (file)

Function: yesterday ()
Package

date-calc

Source

date-calc.lisp (file)


Previous: , Up: Definitions   [Contents][Index]

5.2 Internal definitions


Next: , Previous: , Up: Internal definitions   [Contents][Index]

5.2.1 Special variables

Special Variable: century-of-epoc

Century of reference (epoc)

Package

date-calc

Source

date-calc.lisp (file)

Special Variable: day-of-week-abbreviation
Package

date-calc

Source

date-calc.lisp (file)

Special Variable: days-in-month-arr
Package

date-calc

Source

date-calc.lisp (file)

Special Variable: days-in-year-arr
Package

date-calc

Source

date-calc.lisp (file)

Special Variable: epoc

reference year (epoc)

Package

date-calc

Source

date-calc.lisp (file)

Special Variable: language-to-text
Package

date-calc

Source

date-calc.lisp (file)

Special Variable: languages
Package

date-calc

Source

date-calc.lisp (file)

Special Variable: long-format
Package

date-calc

Source

date-calc.lisp (file)

Special Variable: month-to-text
Package

date-calc

Source

date-calc.lisp (file)

Special Variable: year-of-epoc

Year of reference (epoc)

Package

date-calc

Source

date-calc.lisp (file)


Previous: , Up: Internal definitions   [Contents][Index]

5.2.2 Functions

Function: day-of-week-to-text N
Package

date-calc

Source

date-calc.lisp (file)

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 (file)

Function: normalize-signs DD DH DM DS

Internal fn for normalize-dhms.

Package

date-calc

Source

date-calc.lisp (file)

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 (file)


Previous: , Up: Top   [Contents][Index]

Appendix A Indexes


Next: , Previous: , Up: Indexes   [Contents][Index]

A.1 Concepts

Jump to:   D   F   L  
Index Entry  Section

D
date-calc.asd: The date-calc․asd file
date-calc/date-calc.lisp: The date-calc/date-calc․lisp file

F
File, Lisp, date-calc.asd: The date-calc․asd file
File, Lisp, date-calc/date-calc.lisp: The date-calc/date-calc․lisp file

L
Lisp File, date-calc.asd: The date-calc․asd file
Lisp File, date-calc/date-calc.lisp: The date-calc/date-calc․lisp file

Jump to:   D   F   L  

Next: , Previous: , Up: Indexes   [Contents][Index]

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: Exported functions
add-delta-dhms: Exported functions
add-delta-ym: Exported functions
add-delta-ymd: Exported functions
add-delta-ymdhms: Exported functions
add-year-month: Exported functions

B
business-to-standard: Exported functions

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

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

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

G
gmtime: Exported functions

I
iso-lc: Exported functions
iso-uc: Exported functions

L
leap-year: Exported functions
leap-year-p: Exported functions
localtime: Exported functions

M
monday-of-week: Exported functions

N
normalize-dhms: Exported functions
normalize-ranges: Internal functions
normalize-signs: Internal functions
normalize-time: Internal functions
now: Exported functions
nth-weekday-of-month-year: Exported functions

S
standard-to-business: Exported functions
system-clock: Exported functions

T
this-year: Exported functions
today: Exported functions
today-and-now: Exported functions
tomorrow: Exported functions

V
valid-month-p: Exported functions
valid-year-p: Exported functions

W
week-number: Exported functions
week-of-year: Exported functions
weeks-in-year: Exported functions

Y
year-to-days: Exported functions
yesterday: Exported functions

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

Next: , Previous: , Up: Indexes   [Contents][Index]

A.3 Variables

Jump to:   *  
C   D   E   L   M   S   Y  
Index Entry  Section

*
*language*: Exported special variables

C
century-of-epoc: Internal special variables

D
day-of-week-abbreviation: Internal special variables
days-in-month-arr: Internal special variables
days-in-year-arr: Internal special variables

E
epoc: Internal special variables

L
language-to-text: Internal special variables
languages: Internal special variables
long-format: Internal special variables

M
month-to-text: Internal special variables

S
Special Variable, *language*: Exported special variables
Special Variable, century-of-epoc: Internal special variables
Special Variable, day-of-week-abbreviation: Internal special variables
Special Variable, days-in-month-arr: Internal special variables
Special Variable, days-in-year-arr: Internal special variables
Special Variable, epoc: Internal special variables
Special Variable, language-to-text: Internal special variables
Special Variable, languages: Internal special variables
Special Variable, long-format: Internal special variables
Special Variable, month-to-text: Internal special variables
Special Variable, year-of-epoc: Internal special variables

Y
year-of-epoc: Internal special variables

Jump to:   *  
C   D   E   L   M   S   Y  

Previous: , Up: Indexes   [Contents][Index]

A.4 Data types

Jump to:   D   P   S  
Index Entry  Section

D
date-calc: The date-calc system
date-calc: The date-calc package

P
Package, date-calc: The date-calc package

S
System, date-calc: The date-calc system

Jump to:   D   P   S