Browse Source

Add documentation for date_format validation rule.

Franz Liedke 12 years ago
parent
commit
e407e67559
1 changed files with 10 additions and 2 deletions
  1. 10 2
      laravel/documentation/validation.md

+ 10 - 2
laravel/documentation/validation.md

@@ -196,14 +196,22 @@ Many times, when updating a record, you want to use the unique rule, but exclude
 
 
 #### Validate that a date attribute is before a given date:
 #### Validate that a date attribute is before a given date:
 
 
-	'birthdate' => 'before:1986-28-05';
+	'birthdate' => 'before:1986-28-05',
 
 
 #### Validate that a date attribute is after a given date:
 #### Validate that a date attribute is after a given date:
 
 
-	'birthdate' => 'after:1986-28-05';
+	'birthdate' => 'after:1986-28-05',
 
 
 > **Note:** The **before** and **after** validation rules use the **strtotime** PHP function to convert your date to something the rule can understand.
 > **Note:** The **before** and **after** validation rules use the **strtotime** PHP function to convert your date to something the rule can understand.
 
 
+#### Validate that a date attribute conforms to a given format:
+
+    'start_date' => 'date_format:H\\:i'),
+
+> **Note:** The backslash escapes the colon so that it does not count as a parameter separator.
+
+The formatting options for the date format are described in the [PHP documentation](http://php.net/manual/en/datetime.createfromformat.php#refsect1-datetime.createfromformat-parameters).
+
 <a name="rule-email"></a>
 <a name="rule-email"></a>
 ### E-Mail Addresses
 ### E-Mail Addresses