Skip to content

jayesh-w/time-man

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Time-man JS

A Simple JavaScript Library to manage "Time".


Installation

1. NPM

$npm install time-man

and then

const Time = require('time-man');

2. Script Tag

<script src="dist/time-man.min.js"></script>

<!-- or ---->

<script src="dist/time-man.js"><script>

Usage

  1. To declare a time object like Date() in JS.
  2. Basic add/subtract,average and more handy functions.

Declare a time object

const object = new Time();

//OR

const object = new Time('23:56:00');

// OR

const object = new Time('23:56:00','H:i:s');

//OR

const object = new Time('23:56','H:i');

log the time

object.logTime()


Object Methods[object.Method()]

Method Description
string getTime() Returns a string .
logTime() Logs the time directly to console.
string addTime([object]) adds time to current object
string addTime(['00:00:00'],[format]) adds Time to current object
string subTime([object]) subtracts time from current object
string subTime(['00:00:00'],[format]) subtracts Time from current object
string getFormat() get the format of time
string getTime_12Hr() returns 12-Hr format of Time.
string getTimeZone() returns the Time Zone.

Static Methods [Time.method()]

Method Description
string averageTime([Array of Times) Returns average of Time.
object TimeSlicer([from time][to time][per Slot time]) Returns an object of slotted Time.
string UnixTimeStamp() get the current Unix Time Stamp
string CurrentDate() get the current Date
string TimeStamp() get SQL friendly TimeStamp eg 2020-12-12 23:23:23
string TimeZone() get Current TimeZone(same as getTimeZone)

People

Author Jayesh Waghmare


License

MIT

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published