Write a PHP script to a convert string to Date and DateTime.
Sample Date : '12-08-2004'Note : PHP considers '/' to mean m/d/Y format and '-' to mean d-m-Y format
<?php $dt = DateTime::createFromFormat('m-d-Y', '12-08-2004')->format('Y-m-d'); echo $dt; ?>
Sample Output:
2004-12-08
total answers (1)
start bookmarking useful questions and collections and save it into your own study-lists, login now to start creating your own collections.
Sample Output:
need an explanation for this answer? contact us directly to get an explanation for this answer