0

I think this is asked before but i didn´t find it so here is the question:

How do i convert this:

2014-03-06 01:02:22

to this:

March 06, 2014 at 1:02 am

Need this in php.

Thanks!

Kevinkuijer
  • 130
  • 1
  • 13

1 Answers1

1

It's quite easy if you have a valid date.

The procedural version of this is:

$date = '2014-03-06 01:02:22';
$unixTimestamp = strtotime($date);
echo date('jS m y', $unixTimestamp);

You can use any format you want instead of jS m y, check the full list here: http://php.net/manual/ro/function.date.php

Vlad Preda
  • 9,780
  • 7
  • 36
  • 63