close ad
Help us test the new Databridge BETA with MySQLi support
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

Need to add 8 hours to a DATETIME

Thread began 4/01/2013 12:28 pm by mrs | Last modified 4/02/2013 11:07 am by mrs | 2827 views | 8 replies

Christopher WestCommunity Expert

Ok I think I have something that uses a stored datetime in a users table in the database (if thats what you would want to do since if they update content you would want to store the datetime of that content entry in the users table). (28800 is in seconds = 8 hours)

Ive used long variable names to make the below example more meaningful:
Plus I am echoing the 2 variables just for demonstration of both datetimes to compare.

Its the first time I done this sort of thing so its a little crude :)

<?php
$currentdatetime = date('l jS M Y H:i:s');
$storeddatetimeandeighthours = date('l jS M Y H:i:s',strtotime($row_rsMembers['MemberValidTo'])+28800);
?>
<?php echo $currentdatetime; ?>
<BR>
<?php echo $storeddatetimeandeighthours; ?>
<p>&nbsp;</p>


<?php
if ("".$currentdatetime ."" < "".$storeddatetimeandeighthours ."") { // WebAssist Show If
?>
<p>This text will only show if under the datetime stored in database is less than 8 hours of current datetime</p>
<?php
} // ("".$currentdatetime ."" < "".$storeddatetimeandeighthours ."")
?>

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...