-8

How can I get the hours and minutes of '1:24 pm Tue 19 May'? Thanks

My Test:

<?php
$start_date = date("Y-m-d", strtotime($start_date_full));
$start_time = date("H:i a", strtotime($start_date_full));
echo $start_date . ', ' . $start_time;

Output:

2015-05-19, 00:00

marknt15
  • 5,047
  • 14
  • 59
  • 67

3 Answers3

0

You can do this...

 $d = '2015-05-19 13:24:00';
 $f = date('g:i a D d M', strtotime($d));
 echo $f;

 // OUTPUT : 1:24 pm Tue 19 May

Follow this - http://php.net/manual/en/function.date.php

Devasish
  • 1,917
  • 2
  • 22
  • 32
0

Try this, I think that's what you want

$date = date("g:i a l d F");  

Output :

5:41 am Tuesday 19 May

DadaArno
  • 193
  • 2
  • 16
0

Try this way

$start_date_full = "1:24 pm Tue 19 May";
$format = "g:i a D j F";
$date_time = DateTime::createFromFormat($format, $start_date_full);
echo date_format($date_time,"g:i");