App::Sqitch::DateTime3pm
Sqitch datetime object
Usage
my $dt = App::Sqitch::DateTime->new(%params);say $dt->as_string( format => 'iso' );
Overview
This subclass of DateTime provides additional interfaces to support named formats. These can be used for status or log "--date-format" options. App::Sqitch::DateTime provides a list of supported formats, validates that a format string, and uses the formats to convert itself into the appropriate string.
Interface
Class Methods
"as_string_formats"
my @formats = App::Sqitch::DateTime->as_string_formats;
Returns a list of formats supported by the "format" parameter to "as_string". The list currently includes:
- "iso"
- "iso8601"
-
ISO-8601 format.
- "rfc"
- "rfc2822"
-
RFC-2822 format.
- "full"
- "long"
- "medium"
- "short"
-
Localized format of the specified length.
- "raw"
-
Show timestamps in raw format, which is strict ISO-8601 in the UTC time zone.
- "strftime:$string"
-
Show timestamps using an arbitrary
"strftime"pattern. See "strftime Paterns" in DateTime for comprehensive documentation of supported patterns.
- "cldr:$string"
-
Show timestamps using an arbitrary
"cldr"pattern. See "CLDR Paterns" in DateTime for comprehensive documentation of supported patterns.
"validate_as_string_format"
App::Sqitch::DateTime->validate_as_string_format($format);
Validates that a format is supported by "as_string". Throws an exception if it's not, and returns if it is.
Instance Methods
"as_string"
$dt->as_string;$dt->as_string( format => $format );
Returns a string representation using the provided format. The format must be one of those listed by "as_string_formats" or an exception will be thrown. If no format is passed, the string will be formatted with the "raw" format.
Releases
6 releases since Debian 8 (Jessie); the text changed 5 times.