Luey
asked on
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 '])); ?>
<?php echo date("g:ia", strtotime($row_event['evn_
ASKER
@Rik-Legger
That changed all the times to 9:33 pm no matter what was in the data.
That changed all the times to 9:33 pm no matter what was in the data.
Ok sorry,
forgot to mention that $row_event['evn_entry_date '] should be a unix timestamp.
This would work:
forgot to mention that $row_event['evn_entry_date
This would work:
echo date("d-m-Y H:i:s", strtotime('+2 hours', strtotime($row_event['evn_entry_date'])));
ASKER
2011-09-26 10:12:46 This is what my timestamp looks like in my data. How do I know what kind it is.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
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']))) ; ?>
<?php echo date("g:ia", strtotime('+2 hours', strtotime($row_classified[
Open in new window