|
-
Oct 4th, 2008, 09:33 AM
#1
Thread Starter
Hyperactive Member
Add an hour to time
Hello all,
I am trying to edit an existing php script. I need to know how I can add an hour to
PHP Code:
echo current_time( 'mysql' );
The output from the following code shows differently
PHP Code:
echo current_time( 'mysql' )+3600;
please help asap.
thanks
-
Oct 4th, 2008, 09:43 AM
#2
Re: Add an hour to time
What is 'current_time'? What does it return? What does what it returns represent?
-
Oct 4th, 2008, 10:17 AM
#3
Thread Starter
Hyperactive Member
Re: Add an hour to time
PHP Code:
echo current_time( 'mysql' );
will return the current system time like
Code:
2008-10-04 15:16:07
i would like to add an hour to that
-
Oct 9th, 2008, 03:47 AM
#4
Re: Add an hour to time
Although I don't have the code on me right now.
You could break that date down into a UNIX timestamp, then add 3600 to it, then, format it back to its original value.
Any one know a better method of doing so?
-
Oct 16th, 2008, 10:35 PM
#5
Re: Add an hour to time
how about a date_add function? oh, how convenient 
PHP Code:
$date = new DateTime("2008-10-04 15:16:07 ");
date_add($date, new DateInterval("P5H")); echo '<br />'.$date->format("d-m-Y").' : 5 Hours';
My usual boring signature: Something
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|