View on
Flávio Soibelmann Glock > DateTime-Incomplete-0.07 > DateTime::Incomplete



Annotate this POD


New  1
Open  2
View/Report Bugs
Module Version: 0.07   Source   Latest Release: DateTime-Incomplete-0.08


DateTime::Incomplete - An incomplete datetime, like January 5


  my $dti = DateTime::Incomplete->new( year => 2003 );
  # 2003-xx-xx
  $dti->set( month => 12 );
  # 2003-12-xx
  $dt = $dti->to_datetime( base => DateTime->now );
  # 2003-12-19T16:54:33


DateTime::Incomplete is a class for representing partial dates and times.

These are actually encountered relatively frequently. For example, a birthday is commonly given as a month and day, without a year.


Constructor and mutator methods (such as new and set) will die if there is an attempt to set the datetime to an invalid value.

Invalid values are detected by setting the appropriate fields of a "base" datetime object. See the set_base method.

Accessor methods (such as day()) will return either a value or undef, but will never die.


A DateTime::Incomplete object can have a "base" object. This object is used as a default datetime in the to_datetime() method, and it also used to validate inputs to the set() method.

The base object must use the year/month/day system. Most calendars use this system including Gregorian (DateTime) and Julian. Note that this module has not been well tested with base objects from classes other than class.

By default, newly created DateTime::Incomplete objects have no base.


Most methods provided by this class are designed to emulate the behavior of whenever possible.

"Get" Methods

Computed Values

All other accessors, such as day_of_week(), or week_year() are computed from the base values for a datetime. When these methods are called, they return the requested information if there is enough data to compute them, otherwise they return undef

Unimplemented Methods

The following methods are not implemented in DateTime::Incomplete, though some of them may be implemented in future versions:

"Set" Methods


DateTime::Incomplete objects also have a number of methods unique to this class.


Support for this module is provided via the email list. See for more details.


Flavio S. Glock <fglock[at]>

With Ben Bennett <fiji[at]>, Claus Farber <claus[at]>, Dave Rolsky <autarch[at]>, Eugene Van Der Pijll <pijll[at]>, Rick Measham <rick[at]>, and the DateTime team.


Copyright (c) 2003 Flavio S. Glock. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

The full text of the license can be found in the LICENSE file included with this module.

SEE ALSO ^ mailing list

syntax highlighting: