1.2.5 • Published 2 years ago
secondstohms v1.2.5
secondstohms
This package converts seconds to a time format (HH:MM:SS) for initial few releases we are only going to return HH:MM:SS format but for later releases we can send different formats to the client
how to use this package:
📦 Install
npm install secondstohms
yarn add secondstohms
🔨 Usage
convertSecondsToHMS: currently we only have one method to require
const { convertSecondsToHMS } = require("secondstohms");
const hms = convertSecondsToHMS(3600);
// displays 01 : 00 : 00
console.log(hms);
// second boolean argument is to get hours and minutes and seconds in an object
// for easy access to separate values
const hms_duplicate = convertSecondsToHMS(9581, true);
// displays { hours: 2, minutes: 39, seconds: 41 }
console.log(hms_duplicate);
🔨 Usage in modules
import { convertSecondsToHMS } from "secondstohms";
const hms = convertSecondsToHMS(3600);
// displays 01 : 00 : 00
console.log(hms);
// second boolean argument is to get hours and minutes and seconds in an object
// for easy access to separate values
const hms_duplicate = convertSecondsToHMS(9581, true);
// displays { hours: 2, minutes: 39, seconds: 41 }
console.log(hms_duplicate);
🔨 To get hours and minutes separately
can be used as javascript modules as shown below
import { convertToHours, convertToMinutes } from "secondstohms";
const hours = convertToHours(7200);
const minutes = convertToMinutes(7200);
// displays 2 (2 hours)
console.log(hours);
// displays 120 (120 minutes)
console.log(minutes);
publisher
Mantiqh Technologies
1.2.5
2 years ago
1.2.4
2 years ago
1.2.3
2 years ago
1.2.2
2 years ago
1.2.1
2 years ago
1.2.0
2 years ago
1.1.9
2 years ago
1.1.8
2 years ago
1.1.7
2 years ago
1.1.6
2 years ago
1.1.5
2 years ago
1.1.4
2 years ago
1.1.3
2 years ago
1.1.2
2 years ago
1.1.1
2 years ago
1.1.0
2 years ago
1.0.3
2 years ago
1.0.2
2 years ago
1.0.1
2 years ago
1.0.0
2 years ago