cakephp-1.3 > Validation :: date()
A AclBase AclBehavior AclComponent AclNode AclShell Aco AcoAction AjaxHelper ApcEngine ApiShell App AppController AppController AppHelper AppHelper AppModel AppModel Aro AuthComponent B BakeShell BakeTask BehaviorCollection C Cache CacheEngine CacheHelper CakeErrorController CakeLog CakeRoute CakeSchema CakeSession CakeSocket ClassRegistry Component Configure ConnectionManager ConsoleShell ContainableBehavior Controller ControllerTask CookieComponent D DataSource DbAcl DbAclSchema DbConfigTask DboMssql DboMysql DboMysqlBase DboMysqli DboOracle DboPostgres DboSource DboSqlite Debugger Dispatcher E EmailComponent ErrorHandler ErrorHandler ExtractTask F File FileEngine FileLog FixtureTask Folder FormHelper H Helper HtmlHelper HttpSocket I I18n I18nModel i18nSchema I18nShell Inflector IniAcl J JavascriptHelper JqueryEngineHelper JsBaseEngineHelper JsHelper L L10n M MagicDb MagicFileResource MediaView MemcacheEngine Model ModelBehavior ModelTask MootoolsEngineHelper Multibyte N NumberHelper O Object Overloadable Overloadable Overloadable2 Overloadable2 P PagesController PagesController PaginatorHelper Permission PluginShortRoute PluginTask ProjectTask PrototypeEngineHelper R RequestHandlerComponent Router RssHelper S Sanitize Scaffold ScaffoldView SchemaShell Security SecurityComponent SessionComponent SessionHelper SessionsSchema Set Shell ShellDispatcher String T TemplateTask TestSuiteShell TestTask TextHelper ThemeView TimeHelper TranslateBehavior TreeBehavior V Validation View ViewTask X XcacheEngine Xml XmlElement XmlHelper XmlManager XmlNode XmlTextNode

date

line:389 at /cake/libs/validation.php
Date validation, determines if the string passed is a valid date. keys that expect full month, day and year will validate leap years

Method

(boolean) date ($check, $format = 'ymd', $regex = null)

Parameters

ParameterTypeCommentDefault
$check string required a valid date string
$format mixed optional Use a string or an array of the keys below. Arrays should be passed as array('dmy', 'mdy', etc) Keys: dmy 27-12-2006 or 27-12-06 separators can be a space, period, dash, forward slash mdy 12-27-2006 or 12-27-06 separators can be a space, period, dash, forward slash ymd 2006-12-27 or 06-12-27 separators can be a space, period, dash, forward slash dMy 27 December 2006 or 27 Dec 2006 Mdy December 27, 2006 or Dec 27, 2006 comma is optional My December 2006 or Dec 2006 my 12/2006 separators can be a space, period, dash, forward slash 'ymd'
$regex string optional If a custom regular expression is used this is the only validation that will occur. null

Return

boolean

Comment

Date validation, determines if the string passed is a valid date.
keys that expect full month, day and year will validate leap years

@param string $check a valid date string
@param mixed $format Use a string or an array of the keys below. Arrays should be passed as array('dmy', 'mdy', etc)
Keys: dmy 27-12-2006 or 27-12-06 separators can be a space, period, dash, forward slash
mdy 12-27-2006 or 12-27-06 separators can be a space, period, dash, forward slash
ymd 2006-12-27 or 06-12-27 separators can be a space, period, dash, forward slash
dMy 27 December 2006 or 27 Dec 2006
Mdy December 27, 2006 or Dec 27, 2006 comma is optional
My December 2006 or Dec 2006
my 12/2006 separators can be a space, period, dash, forward slash
@param string $regex If a custom regular expression is used this is the only validation that will occur.
@return boolean Success
@access public