close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

Timestamp Calculations

Thread began 9/07/2009 7:52 am by Kevin373660 | Last modified 9/10/2009 12:29 pm by Kevin373660 | 5404 views | 7 replies

Kevin373660

Timestamp Calculations

I am using DataAssist and eCart to handle a user pass renewal system with php and MySQL. I am stuck with calculating dates and need some direction from a fellow member of the forum. I have been echoing the values on screen simply for testing purposes so that I can verify my math before doing the record update. My understanding is that using TimeStamp the dates are stored in seconds.

I need to be able to:

1) Calculate the new Expiry Date (in a format ready for record update to db schema table) NewActivationDate=TodaysDate+(NewPassLength+RemainingPassLength)
2) Calculate the days remaining in a Pass (display as whole number on screen for user)

After doing the calculations, I know how to do the update using DataAssist record update server behavior. That part is easy, allows additional control with session variables that the standard update record behavior does not have and it works.

With this code:
<?php
echo $row_WAATKtblmembers['passActivation'];
echo $row_WAATKtblmembers['passExpireDate'];
echo strtotime($row_WAATKtblmembers['passActivation']), "\n";
echo strtotime($row_WAATKtblmembers['passExpireDate']), "\n";
echo $_SESSION['ActivationPassLength'];
?>

Outputs to screen the following:
2009-09-01 00:00:00
2009-09-10 00:00:00
1251777600
1252555200
6

However, a simple math calc:
<?php
$datetoday = $_SERVER['REQUEST_TIME'];
$passExpireDate = $row_WAATKtblmembers['passExpireDate'];
$passDaysRemaining = ($passExpireDate - $datetoday);
echo $passDaysRemaining;
?>

I expected a positive value like 777600 however, it Outputs to screen the following negative value: -1252332020

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...