almightyegg Posted April 3, 2008 Share Posted April 3, 2008 I was wondering if somebody could point me in the right direction (either by starting the code/telling me the functions I need to use/sending me to a tutorial) for taking a timestamp and working out how many years, months, weeks, days, hours, minutes, seconds ago it was. Thanks in advance Link to comment https://forums.phpfreaks.com/topic/99295-timestamp-question/ Share on other sites More sharing options...
tabatsoy Posted April 3, 2008 Share Posted April 3, 2008 you mean you want to echo the current time and day? Link to comment https://forums.phpfreaks.com/topic/99295-timestamp-question/#findComment-508039 Share on other sites More sharing options...
almightyegg Posted April 3, 2008 Author Share Posted April 3, 2008 no, I want to take the current timestamp and an old one that's saved and echo the years, months, weeks, days, hours, minutes and seconds since then Link to comment https://forums.phpfreaks.com/topic/99295-timestamp-question/#findComment-508041 Share on other sites More sharing options...
tabatsoy Posted April 3, 2008 Share Posted April 3, 2008 $timespan = $current - $savedtime; $timetotal = date("H:i:s m/d/Y"); echo $timetotal.'since last savedtime; try it! Link to comment https://forums.phpfreaks.com/topic/99295-timestamp-question/#findComment-508053 Share on other sites More sharing options...
almightyegg Posted April 3, 2008 Author Share Posted April 3, 2008 erm, that'll just show the current time Link to comment https://forums.phpfreaks.com/topic/99295-timestamp-question/#findComment-508060 Share on other sites More sharing options...
unsider Posted April 3, 2008 Share Posted April 3, 2008 $timespan = $current - $savedtime; $timetotal = date("H:i:s m/d/Y"); echo $timetotal.'since last savedtime; try it! This is incorrect. $current = insertYourDateFunction $savedtime = insertTimeStamp $timespan = $current - $savedtime; echo $timespan . 'since last savedtime'; Link to comment https://forums.phpfreaks.com/topic/99295-timestamp-question/#findComment-508069 Share on other sites More sharing options...
tabatsoy Posted April 3, 2008 Share Posted April 3, 2008 ok. Link to comment https://forums.phpfreaks.com/topic/99295-timestamp-question/#findComment-508074 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.