1.0.1 • Published 4 years ago

time-man v1.0.1

Weekly downloads
2
License
MIT
Repository
github
Last release
4 years ago

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>

3. CDN

<script src="https://unpkg.com/time-man@1.0.1/dist/time-man.min.js"></script>

<!-- or -->

<script src="https://unpkg.com/time-man@1.0.1/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 Methodsobject.Method()

MethodDescription
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()

MethodDescription
string averageTime([Array of Times)Returns average of Time.
object TimeSlicer(from timeper 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