time.rb

Path: lib/time.rb
Last Update: Tue Jun 30 13:22:25 -0700 2009

Introduction

This library extends the Time class:

  • conversion between date string and time object.
    • date-time defined by RFC 2822
    • HTTP-date defined by RFC 2616
    • dateTime defined by XML Schema Part 2: Datatypes (ISO 8601)
    • various formats handled by Date._parse (string to time only)

Design Issues

Specialized interface

This library provides methods dedicated to special purposes:

  • RFC 2822, RFC 2616 and XML Schema.
  • They makes usual life easier.

Doesn‘t depend on strftime

This library doesn‘t use strftime. Especially rfc2822 doesn‘t depend on strftime because:

  • %a and %b are locale sensitive

    Since they are locale sensitive, they may be replaced to invalid weekday/month name in some locales. Since ruby-1.6 doesn‘t invoke setlocale by default, the problem doesn‘t arise until some external library invokes setlocale. Ruby/GTK is the example of such library.

  • %z is not portable

    %z is required to generate zone in date-time of RFC 2822 but it is not portable.

Revision Information

$Id$

Required files

parsedate   test/unit  

[Validate]

ruby-doc.org is a service of James Britt and Neurogami, a Ruby application development company in Phoenix, AZ.

Documentation content on ruby-doc.org is provided by remarkable members of the Ruby community.

For more information on the Ruby programming language, visit ruby-lang.org.

Want to help improve Ruby's API docs? See Ruby Documentation Guidelines.