convert 0:00 to 0:00.00 in javascript

I have a function that converts ms to s and m and it will display as 0:00 but i want it to display it as 0:00.0. How would i do this?

function millisToMinutesAndSeconds(millis) {
  var minutes = Math.floor(millis / 60000);
  var seconds = ((millis % 60000) / 1000).toFixed(0);
  return (seconds == 60 ? (minutes+1) + ":00" : minutes + ":" + (seconds < 10 ? "0" : "") + seconds);
}

console.log(
  millisToMinutesAndSeconds(123456)
)

154 thoughts on “convert 0:00 to 0:00.00 in javascript”

  1. Pingback: is splenda keto
  2. Great post. I was checking continuously this
    blog and I am impressed! Extremely useful info specially the last part 🙂 I care for such info a lot.
    I was seeking this certain information for a very long time.
    Thank you and best of luck.

    Reply
  3. Hi! This is kind of off topic but I need some advice from an established blog.
    Is it very difficult to set up your own blog? I’m not very techincal but I can figure
    things out pretty quick. I’m thinking about setting up
    my own but I’m not sure where to begin. Do you have any ideas
    or suggestions? With thanks

    Reply
  4. Hi would you mind letting me know which web host you’re utilizing?
    I’ve loaded your blog in 3 completely different web browsers and I must say this blog loads a lot quicker then most.
    Can you recommend a good hosting provider at a honest price?
    Kudos, I appreciate it!

    Reply
  5. Hmm it seems like your website ate my first comment (it was super long) so I guess I’ll just sum it up what I wrote and say, I’m thoroughly enjoying your blog.
    I too am an aspiring blog writer but I’m still new to everything.
    Do you have any points for first-time blog writers? I’d really appreciate it.

    Reply
  6. You really make it appear really easy along with your presentation however I find this topic to
    be really one thing which I feel I might never understand.
    It sort of feels too complicated and very large for me.
    I am having a look forward on your next publish, I’ll try to get the dangle of it!
    quest bars http://bitly.com/3jZgEA2 quest bars

    Reply
  7. Pingback: hung gay dating
  8. Hi there! I could have sworn I’ve been to this site before but after checking through some
    of the post I realized it’s new to me. Nonetheless, I’m definitely glad I
    found it and I’ll be book-marking and checking back often!

    Reply

Leave a Comment