Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including to-ms with all npm packages installed. Try it out:

var toMs = require("to-ms")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

to-ms v1.2.0

Tiny chained ms creation util

toMs ⏲

A simple and human-friendly millisecond conversion util with awesome chaining.


npm install to-ms
// or
yarn add to-ms


var toMs = require('to-ms');

  function () {
    /* do something */
  }, toMs


All methods are chainable, and easy to use.

var ms = toMs

Browser Support

Just use window.toMs. To support legacy browsers you must use ES5-Shim.


  • toMs.second()
  • toMs.seconds(Number)
  • toMs.minute()
  • toMs.minutes(Number)
  • toMs.hour()
  • toMs.hours(Number)
  • toMs.days(Number)
  • toMs.week()
  • toMs.weeks(Number)
  • toMs.year()
  • toMs.years(Number)


This package was previously owned and maintained by Shuvalov Anton.

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free