/ Published in: PHP

Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
public static function validateDate( $date, $format='YYYY-MM-DD') { switch( $format ) { case 'YYYY/MM/DD': case 'YYYY-MM-DD': break; case 'YYYY/DD/MM': case 'YYYY-DD-MM': break; case 'DD-MM-YYYY': case 'DD/MM/YYYY': break; case 'MM-DD-YYYY': case 'MM/DD/YYYY': break; case 'YYYYMMDD': break; case 'YYYYDDMM': break; default: throw new Exception( "Invalid Date Format" ); } }
Comments
