The cl-date-time-parser Reference Manual

Table of Contents

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

The cl-date-time-parser Reference Manual

This is the cl-date-time-parser Reference Manual, version 0.1.3, generated automatically by Declt version 2.3 "Robert April" on Tue Feb 20 07:59:17 2018 GMT+0.


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

1 Introduction

Last modified: 2014-05-18 14:39:27 tkych

version 0.1.03 (beta)

CL-Date-Time-Parser

In general, an implementation should be conservative in its sending behavior, and liberal in its receiving behavior. RFC791: Internet Protocol

There are a lot of formats to specify the date and time on the Web. For example:

The goal of cl-date-time-parser is to hide the difference between date-time formats, and enable to manage date and time as the one date-time format (Universal Time).

Function parse-date-time parses date-time-string, and return universal-time and fraction. Parsable date-time formats are:

In addition, parse-date-time can liberally parse the above formats with little broken.

Depends-on

Installation

cl-test-grid results:

Auto:
  1. CL-REPL> (ql:quickload :cl-date-time-parser)
Manual:
  1. SHELL$ git clone https://github.com/tkych/cl-date-time-parser
  2. CL-REPL> (push #p"/path-to-cl-date-time-parser/cl-date-time-parser/" asdf:*central-registry*)
  3. CL-REPL> (ql:quickload :cl-date-time-parser) or (asdf:load-system :cl-date-time-parser)

Examples

(parse-date-time "Thu, 23 Jul 2013 19:42:23 GMT") ;RFC 1123
=> 3583597343, 0

(parse-date-time "Thu Jul 23 19:42:23 2013") ;asctime
=> 3583597343, 0

(parse-date-time "Thursday, 23-Jul-13 19:42:23 GMT") ;RFC 1036
=> 3583597343, 0

(parse-date-time "2013-07-23T19:42:23Z") ;RFC 3339
=> 3583597343, 0

(parse-date-time "20130723T194223Z") ;ISO 8601
=> 3583597343, 0

(parse-date-time "Thu, 23 Jul 2013 19:42:23 JST")
=> 3583564943, 0

(parse-date-time "2013-07-23T19:42:23+09:00")
=> 3583564943, 0

(parse-date-time "23 Jul 13 19:42:23 +0900")
=> 3583564943, 0

(parse-date-time "Thu Jul 23 19:42:23 JST 2013")
=> 3583564943, 0

(parse-date-time "2013-07-23T19:42:23.45Z")
=> 3583597343, 0.45

(parse-date-time "2013-01-01")
=> 3565987200, 0

(parse-date-time "2013")
=> 3565987200, 0

(parse-date-time "1 Jan 13")
=> 3565987200, 0

(parse-date-time "2003-12-31T25:14:55Z") ;broken hours
=> 3281908495, 0
(parse-date-time "2004-01-01T01:14:55Z")
=> 3281908495, 0

(parse-date-time "2003-12-31T10:61:55Z") ;broken minuits
=> 3281857315, 0
(parse-date-time "2003-12-31T11:01:55Z")
=> 3281857315, 0

(parse-date-time "2003-12-31T10:14:61Z") ;broken seconds
=> 3281854501, 0
(parse-date-time "2003-12-31T10:15:01Z")
=> 3281854501, 0

(parse-date-time ";3-12-31T10:15:01Z") ;broken two-digit-years c.f. rfc3339, 3.
=> 3597473701, 0
(parse-date-time "2013-12-31T10:15:01Z")
=> 3597473701, 0

For further examples, please see Eval-Test in date-time-parser.lisp

Manual

[Function] PARSE-DATE-TIME date-time-string => universal-time, fraction

Parse date-time-string, and return universal-time and fraction. date-time-string must represent the date-time after 1900-01-01T00:00:00Z.

Parsable Formats:

Reference

Author, License, Copyright


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 cl-date-time-parser

Author

Takaya OCHIAI <tkych.repl@gmail.com>

License

MIT License

Description

Parse date-time-string, and return (values universal-time fraction).
Parsable date-time-format: ISO8601, W3CDTF, RFC3339, RFC822, RFC2822, RFC5322, asctime, RFC850, RFC1036.

Version

0.1.3

Dependencies
Source

cl-date-time-parser.asd (file)

Component

date-time-parser.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 cl-date-time-parser.asd

Location

cl-date-time-parser.asd

Systems

cl-date-time-parser (system)


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

3.1.2 cl-date-time-parser/date-time-parser.lisp

Parent

cl-date-time-parser (system)

Location

date-time-parser.lisp

Packages

cl-date-time-parser

Exported Definitions

parse-date-time (function)

Internal Definitions

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

4 Packages

Packages are listed by definition order.


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

4.1 cl-date-time-parser

Source

date-time-parser.lisp (file)

Nickname

date-time-parser

Use List

common-lisp

Exported Definitions

parse-date-time (function)

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


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

5.1.1 Functions

Function: parse-date-time DATE-TIME-STRING

Parse DATE-TIME-STRING, and return (values UNIVERSAL-TIME FRACTION). DATE-TIME-STRING must represent the date-time after 1900-01-01T00:00:00Z.

Parsable Formats:
* RFC822 Genus: RFC822 (RFC1123, RFC2822, RFC5322), RFC850 (RFC1036) and asctime. * ISO8601 Genus: ISO 8601 (:1988, :2000 and :2004. except for no-year format), W3CDTF, RFC3339.
* Broken format: The above formats with little broken.

Examples:
* (parse-date-time "Thu, 23 Jul 2013 19:42:23 JST")
=> 3583564943, 0

* (parse-date-time "2013-07-23T19:42:23+09:00")
=> 3583564943, 0

* (parse-date-time "23 Jul 13 19:42:23 +0900")
=> 3583564943, 0

* (parse-date-time "Thu Jul 23 19:42:23 JST 2013")
=> 3583564943, 0

* (parse-date-time "2013-07-23T19:42:23.45Z")
=> 3583597343, 0.45

For more examples, see Eval-Test in date-time-parser.lisp

Package

cl-date-time-parser

Source

date-time-parser.lisp (file)


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

5.2 Internal definitions


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

5.2.1 Constants

Constant: +day-secs+
Package

cl-date-time-parser

Source

date-time-parser.lisp (file)

Constant: +hour-secs+
Package

cl-date-time-parser

Source

date-time-parser.lisp (file)

Constant: +minuite-secs+
Package

cl-date-time-parser

Source

date-time-parser.lisp (file)

Constant: +second+
Package

cl-date-time-parser

Source

date-time-parser.lisp (file)


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

5.2.2 Special variables

Special Variable: *day-of-week*
Package

cl-date-time-parser

Source

date-time-parser.lisp (file)

Special Variable: *features-tmp*
Package

cl-date-time-parser

Source

date-time-parser.lisp (file)

Special Variable: *month-ht-in-leap-year*
Package

cl-date-time-parser

Source

date-time-parser.lisp (file)

Special Variable: *month-ht-in-normal-year*
Package

cl-date-time-parser

Source

date-time-parser.lisp (file)

Special Variable: *month-vec-in-leap-year*
Package

cl-date-time-parser

Source

date-time-parser.lisp (file)

Special Variable: *month-vec-in-normal-year*
Package

cl-date-time-parser

Source

date-time-parser.lisp (file)

Special Variable: *tz-abbrev-to-offest*
Package

cl-date-time-parser

Source

date-time-parser.lisp (file)


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

5.2.3 Functions

Function: calc-offset TZ-ABBREV

Return offset for the time-zone-abbrev. If not find offset, return NIL.

Package

cl-date-time-parser

Source

date-time-parser.lisp (file)

Function: get-offset TZ-ABBREV
Package

cl-date-time-parser

Source

date-time-parser.lisp (file)

Function: leap-year-p YEAR

Return T if YEAR is a leap year, otherwise NIL. c.f. RFC3339, (Appendix C. Leap Years)

Package

cl-date-time-parser

Source

date-time-parser.lisp (file)

Function: month-to-ut MONTH LEAP-YEAR?
Package

cl-date-time-parser

Source

date-time-parser.lisp (file)

Function: parse-iso8601-genus DATE-TIME-STRING

Parse DATE-TIME-STRING with ISO8601, W3CDTF or RFC3339 format, and return (values UNIVERSAL-TIME FRACTION).

Reference:
* ISO8601:1988, 2000, 2004
– http://www.iso.org/iso/home/standards/iso8601.htm * W3CDTF – http://www.w3.org/TR/1998/NOTE-datetime-19980827 * RFC3339 – http://tools.ietf.org/html/rfc3339

Package

cl-date-time-parser

Source

date-time-parser.lisp (file)

Function: parse-rfc822-genus DATE-TIME-STRING

Parse DATE-TIME-STRING with RFC822 (RFC1123, RFC2822, RFC5322), RFC850 (RFC1036) or asctime format, and return
(values UNIVERSAL-TIME FRACTION).

Reference:
* RFC822 – http://tools.ietf.org/html/rfc822
* RFC2822 – http://tools.ietf.org/html/rfc2822
* RFC5322 – http://tools.ietf.org/html/rfc5322
* RFC850 – http://tools.ietf.org/html/rfc850
* RFC1036 – http://tools.ietf.org/html/rfc1036
* asctime – http://en.cppreference.com/w/c/chrono/asctime

Package

cl-date-time-parser

Source

date-time-parser.lisp (file)

Function: year-to-ut YEAR
Package

cl-date-time-parser

Source

date-time-parser.lisp (file)


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

Appendix A Indexes


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

A.1 Concepts

Jump to:   C   F   L  
Index Entry  Section

C
cl-date-time-parser.asd: The cl-date-time-parser<dot>asd file
cl-date-time-parser/date-time-parser.lisp: The cl-date-time-parser/date-time-parser<dot>lisp file

F
File, Lisp, cl-date-time-parser.asd: The cl-date-time-parser<dot>asd file
File, Lisp, cl-date-time-parser/date-time-parser.lisp: The cl-date-time-parser/date-time-parser<dot>lisp file

L
Lisp File, cl-date-time-parser.asd: The cl-date-time-parser<dot>asd file
Lisp File, cl-date-time-parser/date-time-parser.lisp: The cl-date-time-parser/date-time-parser<dot>lisp file

Jump to:   C   F   L  

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

A.2 Functions

Jump to:   C   F   G   L   M   P   Y  
Index Entry  Section

C
calc-offset: Internal functions

F
Function, calc-offset: Internal functions
Function, get-offset: Internal functions
Function, leap-year-p: Internal functions
Function, month-to-ut: Internal functions
Function, parse-date-time: Exported functions
Function, parse-iso8601-genus: Internal functions
Function, parse-rfc822-genus: Internal functions
Function, year-to-ut: Internal functions

G
get-offset: Internal functions

L
leap-year-p: Internal functions

M
month-to-ut: Internal functions

P
parse-date-time: Exported functions
parse-iso8601-genus: Internal functions
parse-rfc822-genus: Internal functions

Y
year-to-ut: Internal functions

Jump to:   C   F   G   L   M   P   Y  

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

A.3 Variables

Jump to:   *   +  
C   S  
Index Entry  Section

*
*day-of-week*: Internal special variables
*features-tmp*: Internal special variables
*month-ht-in-leap-year*: Internal special variables
*month-ht-in-normal-year*: Internal special variables
*month-vec-in-leap-year*: Internal special variables
*month-vec-in-normal-year*: Internal special variables
*tz-abbrev-to-offest*: Internal special variables

+
+day-secs+: Internal constants
+hour-secs+: Internal constants
+minuite-secs+: Internal constants
+second+: Internal constants

C
Constant, +day-secs+: Internal constants
Constant, +hour-secs+: Internal constants
Constant, +minuite-secs+: Internal constants
Constant, +second+: Internal constants

S
Special Variable, *day-of-week*: Internal special variables
Special Variable, *features-tmp*: Internal special variables
Special Variable, *month-ht-in-leap-year*: Internal special variables
Special Variable, *month-ht-in-normal-year*: Internal special variables
Special Variable, *month-vec-in-leap-year*: Internal special variables
Special Variable, *month-vec-in-normal-year*: Internal special variables
Special Variable, *tz-abbrev-to-offest*: Internal special variables

Jump to:   *   +  
C   S  

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

A.4 Data types

Jump to:   C   P   S  
Index Entry  Section

C
cl-date-time-parser: The cl-date-time-parser system
cl-date-time-parser: The cl-date-time-parser package

P
Package, cl-date-time-parser: The cl-date-time-parser package

S
System, cl-date-time-parser: The cl-date-time-parser system

Jump to:   C   P   S