1$s = '06/10/2011 19:00:02';
2$date = strtotime($s);
3echo date('d/M/Y H:i:s', $date);
4The above one is the one of the example of converting a string to date.
5echo $s ->format('Y-m-d');
6The above one is another method
1
2<?php
3$date = new DateTime('2000-01-01');
4echo $date->format('Y-m-d H:i:s');
5?>
6
7
1$element = '15-Feb-2009';
2$date = DateTime::createFromFormat('j-M-Y', $element);
1Date to string
2
3$date = "2021/03/13";
4$newdate= date('d M, Y', strtotime($date));
5echo $newdate;
1$date_string_prepared = date_create("2020-08-07");
2$date_string = $date_string_prepared->format("d M Y");
3// result 07 Jul 2020