close ad
 
Important WebAssist Announcement
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 9:28 am by mrs | Last modified 4/02/2013 8:07 am by mrs | 4552 views | 8 replies

Christopher WestCommunity Expert

Some more funky datetime manipulation:

As this is my first time experimenting with this I would like to share... So from the database which has a registration date of the member stored, if I wanted to add 1 month to their registration date and use that with a SHOW IF statement:

(The reason why I am using the timestamp stored in the members database rather then doing the calculation on the page then storing that result in the members table is that I may want to know the actual registration date somewhere else on the website...therefore this approach could have more flexability. especially If I store the "1 month" or "8 Hours" in a table in the database that I could then use as dynamic data...lets say you want to change the 8 hours to something else in the future..in your admin area you could have a page that stores that as well so you wouldnt need to edit the page code manually :)

<?php
$currentdatetime = date('l jS M Y H:i:s');
$storeddatetimeandeighthours = strtotime(date($row_rsMembers['MemberValidTo']). '+1 hour');
?>
<?php echo $currentdatetime; ?>
<BR>
<?php echo date('l jS M Y H:i:s',$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...