add 2 hours to php date

How can I add 2 hours to this.

<?php echo date("g:ia", strtotime($row_event['evn_entry_date'])); ?>
LueyAsked:
Who is Participating?
 
Rik-LeggerConnect With a Mentor Commented:
Is this example not working for you?

echo date("d-m-Y H:i:s", strtotime('+2 hours', strtotime($row_event['evn_entry_date'])));

Open in new window

0
 
Rik-LeggerCommented:
<?php 

echo date("g:ia", strtotime('+2 hours', $row_event['evn_entry_date'])); 

?>

Open in new window

0
 
LueyAuthor Commented:
@Rik-Legger
That changed all the times to 9:33 pm no matter what was in the data.
0
Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

 
Rik-LeggerCommented:
Ok sorry,
forgot to mention that $row_event['evn_entry_date'] should be a unix timestamp.

This would work:

echo date("d-m-Y H:i:s", strtotime('+2 hours', strtotime($row_event['evn_entry_date'])));

Open in new window


0
 
LueyAuthor Commented:
2011-09-26 10:12:46  This is what my timestamp looks like in my data.  How do I know what kind it is.
0
 
LueyAuthor Commented:
Now i got it.  I was only trying to echo the hour and min.  When I tried to change your code i made a slight error the first time. Here is what I ended up with to echo just the hour and min and the 2 hours. In case someone needs the reference.
<?php echo date("g:ia", strtotime('+2 hours', strtotime($row_classified['cls_entry_date']))); ?>
0
All Courses

From novice to tech pro — start learning today.