Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 809
  • Last Modified:

add 6 hours to the following date

I have the following date.
Sun, 22 Jun 2008 00:00:00 -0400
And I get this from converting a yyyy-mm-dd date to
http://us3.php.net/date r format ( RFC 2822 formatted date)

Is their anyway for me to add like 6 hours to this date?
0
casit
Asked:
casit
  • 3
  • 2
  • 2
  • +1
2 Solutions
 
RoonaanCommented:
$newData = strtotime('+6 hours', $originalDate);
0
 
hernst42Commented:
$hour = time() + 6*3600;
or if you already have the value in a variable just
$newHour = $hour + 6*3600;
0
 
Loganathan NatarajanLAMP DeveloperCommented:
just try,

print date("d/m/Y H:i:s",strtotime("+6 hours"));

Open in new window

0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
casitAuthor Commented:
Here is what I'm getting
Warning: strtotime() expects parameter 2 to be long, string given
with this code snippet
$date1 = $row['date'];
$newdate = date("r",strtotime($date1));
$newdate1 = strtotime('+6 hours',$newdate);

Open in new window

0
 
casitAuthor Commented:
anyone?
0
 
hernst42Commented:
Just

echo date("r",strtotime($date1)+6*3600);
0
 
casitAuthor Commented:
I actually figured the problem out.  It was using wrong timezone.
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 3
  • 2
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now