0

I have a database timestamp with this format 2016-06-01 11:46:00 and I would like to convert and echo it to this format Wed. 01-06-2016.I tried a lot but no desirable results..Any ideas?

Thanks a lot, it worked! If I want the difference between today and the past date in days or weeks I think I use date_diff.How exactly?

gdim
  • 203
  • 1
  • 4
  • 13

2 Answers2

3

Simply use date and strtotime:

$time = '2016-06-01 11:46:00';
echo date("D. d-m-Y", strtotime($time)); //Wed. 01-06-2016

Updates:

$grk = array("Tet"); // complete the rest of the array
$eng = array("Wed"); // complete the rest of the array

$time = '2016-06-01 11:46:00';
$date = date("D. d-m-Y", strtotime($time));
echo str_replace($eng, $grk, $date);
1
$time = '2016-06-01 11:46:00';
echo date("D. d-m-Y", strtotime($time)); //Wed. 01-06-2016
kiran gadhvi
  • 228
  • 2
  • 16