0

I have a string which has the value '2015-06-04 00:00:00'

How can I convert this to a date/time stamp using PHP?

Many thanks,

Alec

Alec T
  • 11
  • 1

3 Answers3

1

Try this code

$time = strtotime('2015-06-04 00:00:00'); // convert to datetime
$date = date('Y-m-d H:i:s',$time);        // change format
EstevaoLuis
  • 2,180
  • 7
  • 32
  • 38
0

got your answer you can convert it by use this

$date = strtotime('2015-06-04 00:00:00');
echo $date;
Niraj patel
  • 515
  • 4
  • 11
0

I always prefer to pass from a DateTime class.

php > $dateTime = new DateTime('2015-06-04 00:00:00');
php > echo $dateTime->format('d/m/Y');
04/06/2015
sensorario
  • 18,131
  • 26
  • 91
  • 148