CrossClj

0.14.4 docs

SourceDocs



RECENT
    VARS
    formatter
    formatter-local
    formatters
    Mappable
    parse
    parse-local
    parse-local-date
    parse-local-time
    parsers
    printers
    show-formatters
    to-map
    unparse
    unparse-local
    unparse-local-date
    unparse-local-time
    with-chronology
    with-default-year
    with-locale
    with-pivot-year
    with-zone

    « Index of all namespaces of this project

    Utilities for parsing and unparsing DateTimes as Strings.
    
    Parsing and printing are controlled by formatters. You can either use one
    of the built in ISO 8601 and a single RFC 822 formatters or define your own, e.g.:
    
      (def built-in-formatter (formatters :basic-date-time))
      (def custom-formatter (formatter "yyyyMMdd"))
    
    To see a list of available built-in formatters and an example of a date-time
    printed in their format:
    
     (show-formatters)
    
    Once you have a formatter, parsing and printing are strait-forward:
    
      => (parse custom-formatter "20100311")
      #<DateTime 2010-03-11T00:00:00.000Z>
    
      => (unparse custom-formatter (date-time 2010 10 3))
      "20101003"
    
    By default the parse function always returns a DateTime instance with a UTC
    time zone, and the unparse function always represents a given DateTime
    instance in UTC. A formatter can be modified to different timezones, locales,
    etc with the functions with-zone, with-locale, with-chronology,
    with-default-year and with-pivot-year.
    (formatter fmts)(formatter fmts dtz)(formatter dtz fmts & more)
    Returns a custom formatter for the given date-time pattern.
    
    (formatter-local fmt)
    Returns a custom formatter with no time zone info.
    
    Map of ISO 8601 and a single RFC 822 formatters that can be used for parsing and, in most
    cases, printing.
    protocol
    (instant->map instant)
    Returns a map representation of the given instant.
    It will contain the following keys: :years, :months,
    :days, :hours, :minutes and :seconds.
    (parse fmt s)(parse s)
    Returns a DateTime instance in the UTC time zone obtained by parsing the
    given string according to the given formatter.
    (parse-local fmt s)(parse-local s)
    Returns a LocalDateTime instance obtained by parsing the
    given string according to the given formatter.
    (parse-local-date fmt s)(parse-local-date s)
    Returns a LocalDate instance obtained by parsing the
    given string according to the given formatter.
    (parse-local-time fmt s)(parse-local-time s)
    Returns a LocalTime instance obtained by parsing the
    given string according to the given formatter.
    (show-formatters)(show-formatters dt)
    Shows how a given DateTime, or by default the current time, would be
    formatted with each of the available printing formatters.
    Private
    (to-map years months days hours minutes seconds)
    (unparse fmt dt)
    Returns a string representing the given DateTime instance in UTC and in the
    form determined by the given formatter.
    (unparse-local fmt dt)
    Returns a string representing the given LocalDateTime instance in the
    form determined by the given formatter.
    (unparse-local-date fmt ld)
    Returns a string representing the given LocalDate instance in the form
    determined by the given formatter.
    (unparse-local-time fmt lt)
    Returns a string representing the given LocalTime instance in the form
    determined by the given formatter.
    (with-chronology f c)
    Return a copy of a formatter that uses the given Chronology.
    
    (with-default-year f default-year)
    Return a copy of a formatter that uses the given default year.
    
    (with-locale f l)
    Return a copy of a formatter that uses the given Locale.
    
    (with-pivot-year f pivot-year)
    Return a copy of a formatter that uses the given pivot year.
    
    (with-zone f dtz)
    Return a copy of a formatter that uses the given DateTimeZone.