Name

App::Sqitch::DateTime - Sqitch DateTime object

Synopsis

my $dt = App::Sqitch::DateTime->new(%params);
say $dt->as_string( format => 'iso' );

Description

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.

See Also

sqitch-status

Documentation for the status command to the Sqitch command-line client.

sqitch-log

Documentation for the log command to the Sqitch command-line client.

sqitch

The Sqitch command-line client.

Author

David E. Wheeler <david@justatheory.com>

License

Copyright (c) 2012-2023 iovation Inc., David E. Wheeler

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.