Alegro
Alegro

Reputation: 7956

How to display date and time in two rows?

Please, help about formatting date in a .php page:
...return`

<div class="date">'.date('d M Y - H:m',$d['dt']).'</div>

this id displayed as 21 Dec 2012 - 20:12

I want first row: 21 Dec 2012
--------and second: 20:12

I tried many combinations with <br/>, points, brackets...

Upvotes: 0

Views: 261

Answers (2)

Bryan
Bryan

Reputation: 358

I would use 2 date function:

$one = date('d M Y');
$two = date('H:m');


echo "<div class='date'>";
echo $one;
echo "<br />";
echo $two;
echo "</div>";

Upvotes: 1

Niet the Dark Absol
Niet the Dark Absol

Reputation: 324610

You could just use two date() calls:

<div class="date">'.date("d M Y",$d['dt']).'<br />'.date("H:m",$d['dt']).'</div>

Or escape properly:

date('d M Y <\b\r /> H:m',$d['dt'])

Upvotes: 3

Related Questions