1Data::FormValidator::CoUnssetrraCionnttsr:i:bDuatteDedast(Pa3e:)r:lFoDromcVuamleindtaattoiro:n:Constraints::Dates(3)
2
3
4
6 Data::FormValidator::Constraints::Dates - Validate Dates and Times
7
9 use Data::FormValidator::Constraints::Dates qw(date_and_time);
10
11 # In a DFV profile...
12 constraint_methods => {
13 # 'pp' denotes AM|PM for 12 hour representation
14 my_time_field => date_and_time('MM/DD/YYYY hh:mm:ss pp'),
15 }
16
18 date_and_time
19 Note: This is a new module is a new addition to Data::FormValidator and
20 is should be considered "Beta".
21
22 This constraint creates a regular expression based on the format string
23 passed in to validate your date against. It understands the following
24 symbols:
25
26 Y year (numeric)
27 M month (numeric)
28 D day (numeric)
29 h hour
30 m minute
31 s second
32 p AM|PM
33
34 Other parts of the string become part of the regular expression, so you
35 can do perlish things like this to create more complex expressions:
36
37 'MM?/DD?/YYYY|YYYY-MM?-DD?'
38
39 Internally Date::Calc is used to test the functions.
40
42 This older, more awkward interface is supported:
43
44 # In a Data::FormValidator Profile:
45 validator_packages => [qw(Data::FormValidator::Constraints::Dates)],
46 constraints => {
47 date_and_time_field => {
48 constraint_method => 'date_and_time',
49 params=>[\'MM/DD/YYYY hh:mm:ss pp'], # 'pp' denotes AM|PM for 12 hour representation
50 },
51 }
52
54 o Data::FormValidator
55
56 o Data::FormValidator::Constraints::DateTime - This alternative
57 features returning dates as DateTime objects and validating against
58 the date formats required for the MySQL and PostgreSQL databases.
59
61 Mark Stosberg, <mark@summersault.com>
62
63 Featuring clever code by Jan Krynicky.
64
66 Copyright 2003-2005 by Mark Stosberg
67
68 This library is free software; you can redistribute it and/or modify it
69 under the same terms as Perl itself.
70
71
72
73perl v5.38.0 202D3a-t0a7:-:2F0ormValidator::Constraints::Dates(3)