Nicolas Franck
and 5 contributors

NAME

Catmandu::Fix::datetime_diff - Catmandu Fix to compute difference in seconds between two datetimes

SYNOPSIS

  datetime_diff('diff','startTime','endTime',
    'start_pattern' => '%Y-%m-%d',
    'end_pattern' => '%Y-%m-%d',
    'start_time_zone' => 'UTC',
    'end_time_zone' => 'Europe/Brussels',
    'delete' => 1,
    validate => 0,
    start_locale => 'en_US',
    end_locale => 'nl_NL'
  )

OPTIONS

start_pattern

Pattern of the start date string to parse. See DateTime::Format::Strptime for documentation of the format. The default is %FT%T.%NZ (UTC datetime string).

end_pattern

Pattern of the end date string. See DateTime::Format::Strptime for documentation of the format. The default is %FT%T.%NZ (UTC datetime string).

start_time_zone

Time zone of the start date string. In case the start 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.

end_time_zone

Time zone of the end date string. In case the end 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.

start_locale

Language code for the start 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.

end_locale

Language code for the end 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.

delete

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

validate

Validate start and end date string when parsing. Disabled (0) by default to increase speed.

AUTHOR

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

SEE ALSO

Catmandu::Fix