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,422
  • 7
  • 33
  • 40
0

got your answer you can convert it by use this

$date = strtotime('2015-06-04 00:00:00');
echo $date;
Niraj patel
  • 525
  • 4
  • 12
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
  • 20,262
  • 30
  • 97
  • 159