Giter VIP home page Giter VIP logo

erlang-datetime's Introduction

Module description
==================
This module provides simple import and export functions for datetime strings
specified by RFC822, RFC2822 and the RSS specification to erlang datetime
tuples as returned for example by erlang:universaltime() or erlang:localtime().


datetime_encode
===============
Convert a erlang datetime struct to its string representation according to
either RFC822 or the RSS specification.

datetime_encode( DateTime, TimeZone, SpecType )
                    |         |         +------- Defaults to 'rfc2822'
                    |         +------- Defaults to 'GMT'
                    +------- Defaults to erlang:universaltime()

DateTime must be of the form {{Year,Month,Day},{Hour,Minute,Second}}. This
         form is returned for example by the erlang functions
         universaltime() or localtime().
TimeZone has to be a zone according to RFC822. Additional time zones may be
         accepted in the future.
SpecType can be either 'rfc822' or 'rss'. Both specifications are basically
         the same except for the length of the year. RSS supports both, two
         and four digit years while rfc882 only accepts two digit year
         representation.
			Some specifications of rfc2882 marked as obsolete and comments are not
			supported as they are basically never used in the real world.


datetime_decode
===============
Converts a DateTime string according to rfc822 or RSS specifications into an
erlang datetime tupel. The first parameter is the datetime string, the second
specifies the handling of years represented as two digits.
According to the RFC822 a year is only represented by its two last digits.
There are some methods provided for expanding those short year representations
to a full year. You can choose between the following expansion rules. The
default rule is 'smart'.
 smart             If the two digit year is less or equal of the two last
                   digits of the current year, assume that the date is from
                   the current century. Otherwise assume that the date is
                   from last century.
                   Example (Current year is 2012):
                     12  will become  2012
                     34  will become  1934
                     05  will become  2005
 current_century   It is assumed that all dates are from this century.
 no_alternation    No alternation is done. Thus two digit years stay as they
                   are.
 DIGIT             DIGIT may be any integer. Using this method you can
                   specify a concrete century. This number is basically
                   added to the two digit year. Thus 34 with DIGIT = 1800
                   will become 1834.

erlang-datetime's People

Contributors

lkiesow avatar waisbrot avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

erlang-datetime's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.