Christopher J. Madsen

NAME

DateTime::Format::XMLTV - Parse and format XMLTV dates and times

VERSION

This document describes version 1.001 of DateTime::Format::XMLTV, released March 8, 2014.

SYNOPSIS

  use DateTime::Format::XMLTV;
  my $dt = DateTime::Format::XMLTV->parse_datetime('20101230150000 +0000');

  # 20101230150000 +0000
  DateTime::Format::XMLTV->format_datetime($dt);

DESCRIPTION

DateTime::Format::XMLTV understands the datetime format used by XMLTV files.

To quote the XMLTV DTD:

    All dates and times in this DTD follow the same format, loosely based on ISO 8601. They can be YYYYMMDDhhmmss or some initial substring, for example if you only know the year and month you can have YYYYMM. You can also append a timezone to the end; if no explicit timezone is given, UTC is assumed. Examples: 200007281733 BST, 200209, 19880523083000 +0300. (BST == +0100.)

METHODS

This class offers the following methods.

  • parse_datetime($string)

  • parse_date($string)

  • parse_time($string)

    These are 3 names for the same method. Given a string containing an XMLTV date, this method will return a new DateTime object. If no time zone is specified in the string, UTC is assumed.

    If given an improperly formatted string, this method may die.

  • format_date($datetime)

    Given a DateTime object, this returns a string in YYYYMMDD format.

  • format_time($datetime)

  • format_datetime($datetime)

    Given a DateTime object, this returns a string in YYYYMMDDhhmmss +HHMM format (where +HHMM is the time zone offset). format_time is an alias for format_datetime, because XMLTV has no time-only format.

SEE ALSO

The XMLTV File format: http://wiki.xmltv.org/index.php/XMLTVFormat

The XMLTV DTD: http://xmltv.cvs.sourceforge.net/*checkout*/xmltv/xmltv/xmltv.dtd

CONFIGURATION AND ENVIRONMENT

DateTime::Format::XMLTV requires no configuration files or environment variables.

INCOMPATIBILITIES

None reported.

BUGS AND LIMITATIONS

No bugs have been reported.

AUTHOR

Christopher J. Madsen <perl AT cjmweb.net>

Please report any bugs or feature requests to <bug-DateTime-Format-XMLTV AT rt.cpan.org> or through the web interface at http://rt.cpan.org/Public/Bug/Report.html?Queue=DateTime-Format-XMLTV.

You can follow or contribute to DateTime-Format-XMLTV's development at https://github.com/madsen/datetime-format-xmltv.

COPYRIGHT AND LICENSE

This software is copyright (c) 2014 by Christopher J. Madsen.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.

DISCLAIMER OF WARRANTY

BECAUSE THIS SOFTWARE IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE SOFTWARE, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE SOFTWARE "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE IS WITH YOU. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR, OR CORRECTION.

IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE SOFTWARE AS PERMITTED BY THE ABOVE LICENSE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE SOFTWARE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE SOFTWARE TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.