Mailing List Archive
tlug.jp Mailing List tlug archive tlug Mailing List Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]Re: [tlug] [OT] Subtracting two times in JavaScript
- Date: Sun, 21 Mar 2010 17:57:37 +0900
- From: Darren Cook <darren@example.com>
- Subject: Re: [tlug] [OT] Subtracting two times in JavaScript
- References: <4BA4D0BD.6030802@example.com> <4BA573B3.8010006@example.com> <4BA5A695.5050103@example.com>
- User-agent: Thunderbird 2.0.0.23 (X11/20090817)
> Problem one is that Firebug keeps giving me the error "elapsed.slice is > not a function". Perhaps as elapsed is an integer, not a string; what you needed is even simpler: var elapsed = end.getTime() - currTime.getTime(); var seconds = Math.floor(elapsed/1000); And if you didn't want the external sprintf dependency, what you had was fine: var minutes = Math.floor(seconds/60); var hours = Math.floor(minutes/60); minutes = minutes - (hours*60); var remainTime = hours + ":" + (minutes<10 ? ("0"+minutes):minutes); Darren -- Darren Cook, Software Researcher/Developer http://dcook.org/gobet/ (Shodan Go Bet - who will win?) http://dcook.org/work/ (About me and my work) http://dcook.org/blogs.html (My blogs and articles)
- Follow-Ups:
- Re: [tlug] [OT] Subtracting two times in JavaScript [SOLVED]
- From: Dave M G
- References:
- [tlug] [OT] Subtracting two times in JavaScript
- From: Dave M G
- Re: [tlug] [OT] Subtracting two times in JavaScript
- From: Fredric Fredricson
- Re: [tlug] [OT] Subtracting two times in JavaScript
- From: Dave M G
Home | Main Index | Thread Index
- Prev by Date: Re: [tlug] [OT] Subtracting two times in JavaScript
- Next by Date: Re: [tlug] [OT] Subtracting two times in JavaScript [SOLVED]
- Previous by thread: Re: [tlug] [OT] Subtracting two times in JavaScript
- Next by thread: Re: [tlug] [OT] Subtracting two times in JavaScript [SOLVED]
- Index(es):
Home Page Mailing List Linux and Japan TLUG Members Links