symfony API

sfValidatorDate Class

You are currently browsing
the website for symfony 1

Visit the Symfony2 website

« Back to API menu


You are currently browsing the symfony API for the 1.1 version. Switch to:
This version of symfony is not maintained anymore.
If some of your projects still use this version, consider upgrading as soon as possible.

sfValidatorDate validates a date. It also converts the input value to a valid date.


sfValidatorDateTime  <  sfValidatorDate  <  sfValidatorBase

Method Summary

Methods inherited from sfValidatorBase

addMessage , addOption , addRequiredOption , asString , clean , configure , doClean , getCharset , getDefaultMessages , getDefaultOptions , getEmptyValue , getErrorCodes , getMessage , getMessages , getMessagesWithoutDefaults , getOption , getOptions , getOptionsWithoutDefaults , getRequiredOptions , hasOption , isEmpty , setCharset , setDefaultMessages , setDefaultOptions , setMessage , setMessages , setOption , setOptions , __construct

Method Details

  • configure ($options, $messages)

    $options An array of options
    $messages An array of error messages

    Configures the current validator.

    Available options:

    * date_format: A regular expression that dates must match
    * with_time: true if the validator must return a time, false otherwise
    * date_output: The format to use when returning a date (default to Y-m-d)
    * datetime_output: The format to use when returning a date with time (default to Y-m-d H:i:s)
    * date_format_error: The date format to use when displaying an error for a bad_format error (use date_format if not provided)
    * max: The maximum date allowed (as a timestamp)
    * min: The minimum date allowed (as a timestamp)
    * date_format_range_error: The date format to use when displaying an error for min/max (default to d/m/Y H:i:s)

    Available error codes:

    * bad_format
    * min
    * max

  • (int) convertDateArrayToTimestamp ($value)

    $value An array of date elements

    Converts an array representing a date to a timestamp.

    The array can contains the following keys: year, month, day, hour, minute, second

    returns A timestamp

  • doClean ()

    @see sfValidatorBase

  • isEmpty ()

    @see sfValidatorBase

  • isValueSet ()