/    Sign up×
Community /Pin to ProfileBookmark

[RESOLVED] Time Manipulation

Hi guys, quick question. I have a time value in seconds (120) and I need it to be converted to a decimal value (0.02). How do I go about this in JS?

Thanks in advance

to post a comment
JavaScript

3 Comments(s)

Copy linkTweet thisAlerts:
@TheBearMayDec 22.2006 — Looks like you're dividing by 6000.... If so:
<i>
</i>var numSec = 120;
var decSec = numSec / 6000;
Copy linkTweet thisAlerts:
@bulgarian388authorDec 22.2006 — Hi, thanks for responding. After some thought on it, I think I actually asked for the wrong thing. The value of 120 seconds is 2/60, for 60 minutes. What I need is to get the 1/100 value out of that. Is that possible?

Thanks again!
Copy linkTweet thisAlerts:
@TheBearMayDec 22.2006 — <i>
</i>var numSec = 120;
var decSec = numSec / 3600;
alert (decSec.toFixed(2));
×

Success!

Help @bulgarian388 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.25,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...