@nisarg99/timeconvertion-js

0.1.0 • Public • Published

TimeConversion-Js

A NPM package that exports functions to convert miliseconds to timestring ( hh:mm:ss ) & convert timestring to milliseconds.

Installation

TimeConversion-Js requires Node.js v4+ to run.

Install the dependencies and devDependencies and start the server.

$ npm install @nisarg99/timeconvertion-js

Development

Convert Microseconds to timestring

var timeConversion = require('@nisarg99/timeconvertion-js')
var ms = '23456733'  // microseconds which you want to convert
var timeString = timeConversion.ConvertMstoTimeString(ms)
console.log(timeString)

Convert Seconds to timestring

var timeConversion = require('@nisarg99/timeconvertion-js')
var seconds = "23457"   // seconds which you want to convert
var timeString = timeConversion.ConvertSecondstoTimeString(seconds)
console.log(timeString)

Convert timestring to Microseconds

var timeConversion = require('@nisarg99/timeconvertion-js')
// options for timestring are ex. "09:45:56" , "36:07", "43"
var timeString = "09:45:56"  // timestring which converts to milliseconds
var microSeconds = timeConversion.ConvertTimeStringtoMs(timeString)
console.log(microSeconds)

Cpnvert timestring to Seconds

var timeConversion = require('@nisarg99/timeconvertion-js')
// options for timestring are ex. "09:45:56" , "36:07", "43"
var timeString = "06:24:32" // timestring which converts to seconds
var seconds = timeConversion.ConvertTimeStringtoSeconds(timeString)
console.log(seconds)

Tests :

Tests are using mocha, to run the tests use:

$ npm test

Found a Issue :

Please tell us here

Want to contribute? Great!

License

MIT

Free Software, Hell Yeah!

Package Sidebar

Install

npm i @nisarg99/timeconvertion-js

Weekly Downloads

4

Version

0.1.0

License

MIT

Unpacked Size

14.2 kB

Total Files

11

Last publish

Collaborators

  • nisarg99