Jump to content

subtract two dates and get an integer???


SystemOverload

Recommended Posts

I have a MySQL field 'orgDateAmended'

 

I need to obtain the number of days since the record was amended in PHP.

 

In plain english  [currentdate] - [orgDateAmended] = x  << i want 'x'

 

I have no issue retrieving the date in MySQL, I just need to know how to subtract the two once I have the orgDateAmended assigned to a PHP Variable.

 

Thanks.

Link to comment
Share on other sites

Ok, I get an integer (74891990) from now()-date_amended, which I presumed was seconds, but with a date of 2009-08-27 23:22:18, now()-this date should result in approx  483,304.79 seconds (8055 mins or 134 hrs or 5.59 days). 

 

If 74891990 were seconds, it would result in 866 days, ie: way out.

 

Can someone explain why I'm getting this figure and give me a hint where I'm going wrong please.

 

Thanks

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.