How to Display the Month, Day of the Month, and Current Time Plus Twelve Hours?

I am looking for help with my PHP code:

$date = date('m/d/Y h:i:s a', time());
echo "The current server timezone is: " . $date;

Currently this outputs:

The current server timezone is: 03/28/2014 01:27:17 pm Friday

I am trying to make this display the current month, day of the month, and the current time plus twelve hours. For example, the output would be:

 The current server timezone is: March 28 Friday at 1:27 am Friday

If anyone can help it will be greatly appreciated. Thank you for any help.


In OOP style:

$dateTime = new DateTime('now');
$dateTime->add(new DateInterval('PT12H'));
echo $dateTime->format('F j l \a\\t h:i a l');

Or just with DateTime:

$dateTime = new DateTime('+12 hours');
echo $dateTime->format('F j l \a\\t h:i a l');

See it in action

If you happen to use Ouzo Goodies in your project then Clock looks neat.

Clock::now()->plusHours(12)->format('F j l \a\\t h:i a l');

echo date('F j l \a\\t h:i a l', strtotime('+12 hours'));

See it in action

It has the day of the week twice as requested. Not sure if you really want that, though.

Need Your Help

How do I store several radio buttons at once into MySQL?

php html mysql button radio

this is my PHP script that lists all of my tags (from a MySQL database) with two radio buttons (enable and disable) for each row. how I can save the changes (if I enable or disable something) into ...

What is the difference between #QNAN and #IND in Lua

lua nan

If you run this through the Lua interpreter