Created
April 27, 2023 11:40
-
-
Save catwhocode/97030991b065c5d8dff90d92ea8cf665 to your computer and use it in GitHub Desktop.
Convert "datetime" string format (Y-m-d H:i:s) to simple date format (dd-mm-yyyy)
This file contains hidden or 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 | |
function formatDate($str) | |
{ | |
return implode("-",array_reverse(explode("-", explode(" ", $str)[0]))); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment