GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
Data::FormValidator::Constraints::Dates(3) User Contributed Perl Documentation Data::FormValidator::Constraints::Dates(3)

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

    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'),
    }

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:

    Y   year  (numeric)
    M   month (numeric)
    D   day   (numeric)
    h   hour
    m   minute
    s   second
    p   AM|PM

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.

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
        },
    }

o
Data::FormValidator
o
Data::FormValidator::Constraints::DateTime - This alternative features returning dates as DateTime objects and validating against the date formats required for the MySQL and PostgreSQL databases.

Mark Stosberg, <mark@summersault.com>

Featuring clever code by Jan Krynicky.

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.

2017-08-28 perl v5.32.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.