man > Data::FormValidator::Constraints::Dates

๐Ÿ“› NAME

Data::FormValidator::Constraints::Dates - Validate Dates and Times

๐Ÿš€ Quick Reference

Use CaseCommandDescription
๐Ÿ” Validate a date/time field with a format stringdate_and_time('MM/DD/YYYY hh:mm:ss pp')๐Ÿงช Uses regex generated from format string, validates with Date::Calc
๐Ÿ”„ Older interface (DFV profile)validated_packages => [...]๐Ÿ“œ Supports constraint_method and params with scalar reference
๐Ÿ“… Validate against multiple formats'MM?/DD?/YYYY|YYYY-MM?-DD?'๐Ÿ”— Combine formats with pipe (|) in the string

๐Ÿ“– SYNOPSIS

use Data::FormValidator::Constraints::Dates qw(date_and_time);

# In a DFV profile...
constraint_methods => {
    # 'pp' denotes AM|PM for 12 hour representation
    my_time_field => date_and_time('MM/DD/YYYY hh:mm:ss pp'),
}

๐Ÿ“ DESCRIPTION

๐Ÿ“… date_and_time

โš ๏ธ Note: This is a new module is a new addition to Data::FormValidator and is should be considered "Beta".

This constraint creates a regular expression based on the format string passed in to validate your date against. It understands the following symbols:

Other parts of the string become part of the regular expression, so you can do perlish things like this to create more complex expressions:

'MM?/DD?/YYYY|YYYY-MM?-DD?'

Internally Date::Calc is used to test the functions.

๐Ÿ”„ BACKWARDS COMPATIBILITY

This older, more awkward interface is supported:

# In a Data::FormValidator Profile:
validator_packages => [qw(Data::FormValidator::Constraints::Dates)],
constraints => {
    date_and_time_field       => {
        constraint_method => 'date_and_time',
        params=>[\'MM/DD/YYYY hh:mm:ss pp'], # 'pp' denotes AM|PM for 12 hour representation
    },
}

๐Ÿ”— SEE ALSO

๐Ÿ‘ค AUTHOR

Mark Stosberg, <mark AT summersault.com>

Featuring clever code by Jan Krynicky.

๐Ÿ“„ COPYRIGHT AND LICENSE

Copyright 2003-2005 by Mark Stosberg

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

๐Ÿ“‹ perl v5.26.1 2017-10-24 Data::FormValidator::Constraints::Dates(3pm)

Data::FormValidator::Constraints::Dates
๐Ÿ“› NAME ๐Ÿš€ Quick Reference ๐Ÿ“– SYNOPSIS ๐Ÿ“ DESCRIPTION
๐Ÿ“… date_and_time
๐Ÿ”„ BACKWARDS COMPATIBILITY ๐Ÿ”— SEE ALSO ๐Ÿ‘ค AUTHOR ๐Ÿ“„ COPYRIGHT AND LICENSE

Generated by phpman v4.10.0-16-g1a0e228 · Markdown · JSON · MCP Author: Che Dong Under GNU General Public License
2026-09-22 22:59 @216.73.217.0
CrawledBy Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)
Valid XHTML 1.0 Transitional!Valid CSS!