{
    "mode": "perldoc",
    "parameter": "Data::FormValidator::Constraints::Dates",
    "section": "",
    "url": "https://www.chedong.com/phpMan.php/perldoc/Data%3A%3AFormValidator%3A%3AConstraints%3A%3ADates/json",
    "generated": "2026-06-10T16:29:57Z",
    "synopsis": "use Data::FormValidator::Constraints::Dates qw(dateandtime);\n# In a DFV profile...\nconstraintmethods => {\n# 'pp' denotes AM|PM for 12 hour representation\nmytimefield => dateandtime('MM/DD/YYYY hh:mm:ss pp'),\n}",
    "sections": {
        "NAME": {
            "content": "Data::FormValidator::Constraints::Dates - Validate Dates and Times\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "use Data::FormValidator::Constraints::Dates qw(dateandtime);\n\n# In a DFV profile...\nconstraintmethods => {\n# 'pp' denotes AM|PM for 12 hour representation\nmytimefield => dateandtime('MM/DD/YYYY hh:mm:ss pp'),\n}\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "dateandtime\nNote: This is a new module is a new addition to Data::FormValidator and is should be considered\n\"Beta\".\n\nThis constraint creates a regular expression based on the format string passed in to validate\nyour date against. It understands the following symbols:\n\nY   year  (numeric)\nM   month (numeric)\nD   day   (numeric)\nh   hour\nm   minute\ns   second\np   AM|PM\n\nOther parts of the string become part of the regular expression, so you can do perlish things\nlike this to create more complex expressions:\n\n'MM?/DD?/YYYY|YYYY-MM?-DD?'\n\nInternally Date::Calc is used to test the functions.\n",
            "subsections": []
        },
        "BACKWARDS COMPATIBILITY": {
            "content": "This older, more awkward interface is supported:\n\n# In a Data::FormValidator Profile:\nvalidatorpackages => [qw(Data::FormValidator::Constraints::Dates)],\nconstraints => {\ndateandtimefield       => {\nconstraintmethod => 'dateandtime',\nparams=>[\\'MM/DD/YYYY hh:mm:ss pp'], # 'pp' denotes AM|PM for 12 hour representation\n},\n}\n",
            "subsections": []
        },
        "SEE ALSO": {
            "content": "o   Data::FormValidator\n\no   Data::FormValidator::Constraints::DateTime - This alternative features returning dates as\nDateTime objects and validating against the date formats required for the MySQL and\nPostgreSQL databases.\n",
            "subsections": []
        },
        "AUTHOR": {
            "content": "Mark Stosberg, <mark@summersault.com>\n\nFeaturing clever code by Jan Krynicky.\n",
            "subsections": []
        },
        "COPYRIGHT AND LICENSE": {
            "content": "Copyright 2003-2005 by Mark Stosberg\n\nThis library is free software; you can redistribute it and/or modify it under the same terms as\nPerl itself.\n",
            "subsections": []
        }
    },
    "summary": "Data::FormValidator::Constraints::Dates - Validate Dates and Times",
    "flags": [],
    "examples": [],
    "see_also": []
}