Object::Relation::DataType::DateTime::Incomplete - Incomplete Object::Relation DateTime objects
my $dt = Object::Relation::DataType::DateTime::Incomplete->new( month => 10, day => 16, );
This module subclasses the DateTime::Incomplete module to offer DateTime::Incomplete objects to Object::Relation applications. The only way in which it differs from DateTime::Incomplete is that all new Object::Relation::DataType::DateTime objects are in the "UTC" time zone unless another time zone is specified and it knows to properly stringify itself when accessed by Object::Relation::Handle.
Constructs and returns a new Object::Relation::DataType::DateTime::Incomplete object. Unless a time zone is specified, the time zone will be UTC.
my $dt = Object::Relation::DataType::DateTime->bake('1964-10-16T16:12:47.0');
Same as new but takes an incomplete iso8601 date string as the argument.
new
if ($date->contiguous) { ... }
This method returns a true or false value depending upon whether or not all of the date components are contiguous. For example, "month, day and hour" are contiguous, but "month, day, and minute" are not.
This method will return false if none of the date components are defined.
use Object::Relation::DataType::DateTime::Incomplete qw/is_incomplete_iso8601/; if (is_incomplete_iso8601('1964-xx-16T16:12:47.0')) { ... }
Returns a true or false value depending upon whether or not the supplied string matches an incomplete ISO 8601 datetime string. This is a function, not a method.
If a particular date segment is not present, it may be replaced with 'Xs'. However, the complete date segment must be replaced. For example, you can replace the year 1968 with 'xxxx', but not '19xx'. If nanoseconds are not present, omit them.
Currently ignores timezone.
It won't match:
1964-10-16T17:12:47.0 # the date is not incomplete 1964-10-16 17:12:47.0 # missing the "T" xx64-10-16T17:12:47.0 # year segment only partially replaced
Valid incomplete datetime strings:
xxxx-10-16T17:12:47.0 1964-xx-16T17:12:47.0 1964-xx-xxT17:xx:xx.0 1964-10-16T17:12:xx
my @fields = $date->defined_store_fields;
This method returns a list of all defined fields which are also valid for the data stores.
my $sortable_string = $date->sort_string;
Returns the date in a string format suitable for sorting. There are no component separators and undefined components are omitted. All components except year are zero padded to 2 characters. The year is zero padded with four characters.
'19970623' eq Object::Relation::DataType::DateTime::Incomplete->new( year => 1997, month => 6, hour => 23 )->sort_string;
if ($date->same_segments($other_date)) { ... }
Returns a boolean value indicating whether or not two dates have the same segments defined.
Copyright (c) 2004-2006 Kineticode, Inc. <info@obj_relode.com>
This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install Object::Relation, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Object::Relation
CPAN shell
perl -MCPAN -e shell install Object::Relation
For more information on module installation, please visit the detailed CPAN module installation guide.