NAME

Catmandu::Fix::datetime_format - Catmandu Fix for converting between datetime formats

SYNOPSIS

datetime_format( 'timestamp',
  'source_pattern' => '%s',
  'destination_pattern' => '%Y-%m-%d',
  'time_zone' => 'UTC',
  'set_time_zone' => 'Europe/Brussels',
  'delete' => 1,
  validate => 0,
  locale => 'en_US',
  set_locale => 'nl_NL'
)

OPTIONS

source_pattern

Pattern of the source date string to parse. See DateTime::Format::Strptime for documentation of the format. The default is %s (Unix timestamp).

destination_pattern

Pattern of the destination date string. This is the way your datetime needs to be formatted. The default is %FT%T.%NZ (UTC timestamp).

time_zone

Time zone of the source date string. In case the source date string does not contain any time zone information, the parser will use this time_zone to interpret the date. When not set correctly, the resulting date string will be wrong. The default value is UTC. For a complete list of time zone codes see http://en.wikipedia.org/wiki/List_of_tz_database_time_zones.

Most parsers assume 'local', but this can lead to different results on different systems. 'local' simply means the same time zone as the one configured on your system.

set_time_zone

Reset the time zone for the destination string. This is usefull for converting dates between time zones, e.g. Europe/Brussels. The default value is UTC.

locale

Language code for the source date string. This is only important when your date string contains names of week days or months. For a complete list of locale codes see DateTime::Locale::Catalog. The default value is en_US.

set_locale

Language code for the destination date string. This is only important when your destination date string contains codes for names of week days or months (%a, %A, %b, %B, and %h). This is usefull for converting dates between languages. For a complete list of locale codes see DateTime::Locale::Catalog. The default value is en_US.

delete

Delete the key when the source date string cannot be parsed. When used, the option default is ignored. Disabled (0) by default.

default

Set the value of the destination string to this value, when parsing fails. By default both the options delete and default are not set, which means that the destination date string will not be created. Not set (undef) by default.

validate

Validate source date string when parsing. Disabled (0) by default to increase speed.

AUTHOR

Nicolas Franck, <nicolas.franck at ugent.be>

SEE ALSO

Catmandu::Fix