-
-
10 Feb 2021 19:11:37 UTC
- Distribution: XML-Loy
- Module version: 0.03
- Source (raw)
- Browse (raw)
- Changes
- How to Contribute
- Repository
- Issues
- Testers (747 / 5 / 1)
- Kwalitee
Bus factor: 1- 88.91% Coverage
- License: perl_5
- Perl: v5.10.1
- Activity
24 month- Tools
- Download (53.85KB)
- MetaCPAN Explorer
- Permissions
- Subscribe to distribution
- Permalinks
- This version
- Latest version
- Dependencies
- List::Util
- Mojolicious
- Scalar::Util
- Socket
- Test::More
- Test::Warn
- Time::Local
- and possibly others
- Reverse dependencies
- CPAN Testers List
- Dependency graph
NAME
XML::Loy::Date::RFC3339 - Date strings according to RFC3339
SYNOPSIS
use XML::Loy::Date::RFC3339; my $date = XML::Loy::Date::RFC3339->new(784111777); my $date_str = $date->to_string; $date->parse('1993-01-01t18:50:00-04:00'); my $epoch = $date->epoch;
DESCRIPTION
XML::Loy::Date::RFC3339 implements date and time functions according to RFC3339. In addition to that it supports granularity as described in W3C date and time formats.
This module is meant to be compatible with the Mojo::Date-API but has no Mojo dependencies.
This module is EXPERIMENTAL and may be changed, replaced or renamed without warnings.
ATTRIBUTES
XML::Loy::Date::RFC3339 implements the following attributes.
epoch
my $epoch = $date->epoch; $date = $date->epoch(784111777);
Epoch seconds.
granularity
my $granularity = $date->granularity; $date->granulariy(3);
Level of granularity.
0: Complete date plus hours, minutes and seconds
1: Complete date plus hours and minutes
2: Complete date
3: Year and month
4: Year
METHODS
XML::Loy::Date::RFC3339 implements the following methods.
new
my $date = XML::Loy::Date::RFC3339->new; my $date = XML::Loy::Date::RFC3339->new($string);
Constructs a new XML::Loy::Date::RFC3339 object. Accepts a date string to be parsed.
parse
$date = $date->parse('1993-01-01t18:50:00-04:00'); $date = $date->parse('1993-01-01'); $date = $date->parse(1312043400);
Parses RFC3339 and granularity compliant date strings. Also accepts epoch seconds.
to_string
my $string = $date->to_string; my $string = $date->to_string(3);
Renders date suitable to RFC3339 without offset information. Takes an optional parameter for granularity. Uses the objects granularity level by default.
DEPENDENCIES
AVAILABILITY
https://github.com/Akron/XML-Loy
COPYRIGHT AND LICENSE
Copyright (C) 2011-2021, Nils Diewald.
The code is heavily based on Mojo::Date, written by Sebastian Riedel. See Mojo::Date for additional copyright and license information.
This program is free software, you can redistribute it and/or modify it under the same terms as Perl.
Module Install Instructions
To install XML::Loy, copy and paste the appropriate command in to your terminal.
cpanm XML::Loy
perl -MCPAN -e shell install XML::Loy
For more information on module installation, please visit the detailed CPAN module installation guide.