Page 1 of 1

Time elapsed

Posted: Thu Apr 25, 2013 9:51 am
by someguyhere
I'll preface this by saying I know next to nothing about javascript. I'm pretty good w/ php, so I understand programming logic, but js is NOT my strong suit.

That being said, here's what I'm looking to do: create a clock that shows the time elapsed since a particular date in Years Months Days Hours:Minutes. I want the clock to run live in the browser.

Can someone please point me in the right direction?

Re: Time elapsed

Posted: Thu Apr 25, 2013 1:05 pm
by requinix
Imagine you're writing a script in PHP that continually outputs the elapsed time.

Code: Select all

$elapsed = 12345; // 12,345 seconds have elapsed since the date
do {
    printElapsedTime($elapsed);
    sleep(1);
    $elapsed++;
} while (true);
What would your printElapsedTime() function look like? We can convert that to Javascript once you know the kind of code needed.