Sign In!
|
New User?Signup Now!
|
Forgot password?
Source Code 4 you
Home
Create Forum Topic
Check WebSite Rank
Publish Articles
UV Web Booster
Contact
Forum Type
Search Engine
.Net C# VB F# VC++
MonoPoject
Java J2EE
Zand Php Cake Php
Oracle Database Server
Mysql Database Server
DB2 Database Server
MSSql Databse Server
Javascript Ajax
Html Xml Xhtml
C Programming
C++ Programming
D Programming
CGI Programming
Perl Programming
Cobol Programming
Pascal Programming
Ruby Programming
Drupal Programming
Automobile
Software Testing
Linux Unix Mac Sun OS
Embedded Systems
Mainframe
IC Microcircuit Chip
Electronics Electrical
Hardware Netwarking
SAP ERP
Logical Reasoning
Human Resources
Science
Agriculture
Accounting
History
Pharmaceutical
Other Topic
Zand Php Cake Php
Posted by :
Phper
How to get a time stamp after two hours in PHP?
For example, when the sever execute <?php echo date("Y-m-d h:i:s") ?>,
I get 2009-09-29 08:01:58. How to get 2009-09-29 10:01:58?
I am developing a functionality that can help a user retrieve his
password. The website will send a hyperlink to the user's Email, but
this hyperlink will expire in two hours. That's why I need to get a
time stamp after two hours.
Posted by :
peterman
Re : How to get a time stamp after two hours in PHP?
How about this,
date("Y-m-d h:i:s", time() + 2 * 3600);
Posted by :
tahir hamid
Re : How to get a time stamp after two hours in PHP?
no
get the current time in a vareable then explode it into an array it
will give u the whole time in an array form then u can add 2 in the
hours and then concate the array again to make the time
Posted by :
j.r.fish
Re : How to get a time stamp after two hours in PHP?
$timestamp = strtotime('now +2 hours');
echo date('Y-m-d H:i:s',$timestamp);
you can replace 'now' with MySQL-like timestamp, like '2009-09-29
12:57:05'
Posted by :
j.r.fish
Re : How to get a time stamp after two hours in PHP?
$timestamp = strtotime('now +2 hours');
echo date('Y-m-d H:i:s',$timestamp);
you can replace 'now' with MySQL-like timestamp, like '2009-09-29
12:57:05'
Posted by :
Matthew Neilson
Re : How to get a time stamp after two hours in PHP?
I would definitely go with Peterman's suggestion.
How about this,
date("Y-m-d h:i:s", time() + 2 * 3600);
The array suggestion has flaws, as does the strtotime function.
Posted by :
Bobby Easland
Re : How to get a time stamp after two hours in PHP?
Please explain the flaws with utilizing the strtotime() function other
than the obvious (should be just '+2 hours').
Posted by :
C.
Re : How to get a time stamp after two hours in PHP?
Why? Surely its going to be more efficient to see if the time when
they requested their password is more than two hours ago rather than
setting an expiry time? It also addresses a lot of possible contention
issues.
If you have the better reply, then send it to us. We will display your reply after the approval.
Name :
Email Id :
Reply :