daniel.tosaba
daniel.tosaba

Reputation: 2563

format time & date

I am fetching two separate variables with time & date as separate values:

$v['EventDate'] => 2012-06-13
$v['StartTime'] => 19:00:00

I would like to present this values in following manner instead:

June 13th, 2012
7:00 PM

Have tried so far executing it this way:

echo date("F jS, Y",mktime($v['EventDate']));
echo date("F jS, Y",mktime($v['StartTime']));

And I get proper format but my values keep increasing over time, to June 14th, and time to after 7 :)

Sorry don't have too much time on my hands to go into this so I was hoping for someone experienced with these functions for a quick tip.

Thank you so much

Upvotes: 1

Views: 110

Answers (2)

safarov
safarov

Reputation: 7804

 echo date("F jS, Y \n g:i A", strtotime($v['EventDate'].' '.$v['StartTime']));

Upvotes: 2

Dion
Dion

Reputation: 3345

Maybe echo date("F jS, Y g:i A",strtotime($v['EventDate'] . " " . $v['StartTime']));

Upvotes: 1

Related Questions