Jump to content

Recommended Posts

Alright..

 

First of whats the best thing to use to make a unix style timestamp?

Next off.. I can use any of them to make a date format that readable just by looking at that I know that much and can do that much.. But I am running into a wall with trying to get it to calculate the difference in seconds, minutes, hours, days, weeks, months, years..

 

What I want to do, is take the timestamp I have or a new one pending on the first question I had.. Then break said time stamp down into seconds, minutes, hours, days, weeks, months, years (each one being a different $var).

 

The concept is 2 timestamps. $timestamp1 made on the page's load.. and $timestamp2 pulled from a database that was generated sometime ago using time() but again willing to change it according to the first question. and get it to calculate the difference in seconds, minutes, hours, days, weeks, months, years.. from there the rest is semantics as to how it will layout on the page using mostly if-then style functions to determine if less then any of the $vars it won't show that element. So if less then a month it will only show seconds minutes hours days or just days in some cases or yea like I said that part is irrelivant.. I just cant figure out how to get the total difference between 1 and 2

Link to comment
https://forums.phpfreaks.com/topic/89088-time-mktime-etc-need-opinions-and-help/
Share on other sites

Oh i wish what i wanted to do was so simple.. Like i said, I can convert it to the time the timestamp was made.. but what I'm doing is trying to find how many seconds, hours, mins, days, weeks...... there were since the orginal timestamp was made..

 

thank you none the less for the reply.. I know its possible, but im stumped, the best I can come up with is the ability to add and or subtract days weeks months etc to the existing timestamp to make future and past dates...

 

but lets say timestamp1 is 987654321 (created on the pages load)

and timestamp2 retrieved from a database is 123456789..

 

What I am doing is trying to figure out how to take the diffrence 864197532 in this example and find out how many seconds mins hours days etc there are in between 987654321 and 123456789 using the difference, if this is even possible.. Maybe theres an easier way to do this whole thing.. again I am over all open to suggestion be it in favor of what I'm saying here or something completely different that actually works..

I guess the concept would follow similar to "Last Date Modified".. or even better.. Google, Gmail to be more exact.. next to your messages they always have a column that says received: and specifies how long ago, seconds, mins, hours, days..

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.