hi
Im trying to get the number of weeks between two timestamps
and display it in a readable format like
12 weeks and two days
this is not as easy as I thought it would be?
can any one help
thanks
Brian
the num of week between two dates
Moderator: General Moderators
-
kettle_drum
- DevNet Resident
- Posts: 1150
- Joined: Sun Jul 20, 2003 9:25 pm
- Location: West Yorkshire, England
Just use a bit of maths. Once you have got the time between in seconds you can then do something like:
Then output it as you wish.
Code: Select all
$time = '50000'; //some random time
$weeks = floor((60*60*24*7)/$time);
$time -= $weeks*(60*60*24*7);
$days = floor((60*60*24)/$time);
$time -= $days*(60*60*24);
$hours = floor((60*60)/$time);
$time -= $hours*(60*60);
$mins = floor(60/$time);
$time -= $mins*60;
$secs = $time;thanks this is good stuff
thanks this is good stuff and it does the job
thanks
brian
thanks
brian