user-local-time
v1.0.4
Published
A simple library to get the current time of the user's computer
Downloads
11
Maintainers
Readme
user-local-time
A simple library to get the current time of the user's computer.
Installation
npm install user-local-time
Usage
const userLocalTime = require('user-local-time');
console.log(userLocalTime.getCurrentTime());
// Output: { hours: 14, minutes: 30, seconds: 45, milliseconds: 123 }
console.log(userLocalTime.getCurrentTimeFormatted());
// Output: "14:30:45"
API
getCurrentTime()
Returns an object with the current hours, minutes, seconds, and milliseconds.
getCurrentTimeFormatted()
Returns a string with the current time in HH:MM:SS format.
License
MIT