Created
April 14, 2022 15:10
-
-
Save othonet/73c5efa06af75cb131ba6a7cd373254d to your computer and use it in GitHub Desktop.
PHP - Validate Date Format
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$valor = '25/12/2016'; | |
$arraData = explode('/', $valor); | |
if(checkdate($arraData[1], $arraData[0], $arraData[2])): | |
echo 'Data válida.'; | |
else: | |
echo 'Data inválida.'; | |
endif; | |
// Saída Data válida |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment