Adding Hoursd

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
moiseszaragoza
Forum Commoner
Posts: 87
Joined: Sun Oct 03, 2004 4:04 pm
Location: Ft lauderdale
Contact:

Adding Hoursd

Post by moiseszaragoza »

OK
I am using the Date function


Code: Select all

<?php echo date('l dS \of F Y h:i:s A');?>
but I want to show the hour two hours ahead

is there any way to do that like

Code: Select all

<?php echo date('l dS \of F Y h+2:i:s A');?>
Deemo
Forum Contributor
Posts: 418
Joined: Sun Jan 18, 2004 11:48 am
Location: Washington DC

Post by Deemo »

strtotime()

so your call would be

Code: Select all

echo date('l dS \of F Y h:i:s A', strtotime("+2 hours"));
User avatar
m3mn0n
PHP Evangelist
Posts: 3548
Joined: Tue Aug 13, 2002 3:35 pm
Location: Calgary, Canada

Post by m3mn0n »

Moved to PHP Code forum.
Post Reply