0.0.44 • Published 6 years ago

util.timestamp v0.0.44

Weekly downloads
21
License
MIT
Repository
github
Last release
6 years ago

util.timestamp

Generates a string timestamp

build analysis code style: prettier testing NPM

This module is a thin wrapper on the strftime module to create a simple string timestamp with a consistent format. It uses the format rule:

%Y%m%d%H%M%S%L

This results in a 17 byte string representing the current timestamp. e.g.

20170126075705148

Installation

This module uses yarn to manage dependencies and run scripts for development.

To install as a global package:

$ yarn global add util.timestamp

To install as a development dependency with cli:

$ yarn add --dev util.timestamp

To build the app and run all tests:

$ yarn run all

Usage

There are two ways to use this package:

  • Command line
  • Function call

Command line

The timestamp can be generated from the command line using:

timestamp

This will return the default format above. This could be used in scripting.

Function call

The default JavaScript call will just return the timestamp format above as a string:

const timestamp = require('util.timestamp');
console.log(timestamp());

The function also has an option to set a format that is acceptable to the strftime library:

const timestamp = require('util.timestamp');
console.log(timestamp({
    dateFormat: '%B %d, %Y %H:%M:%S'
}));

// returns the string: 'April 28, 2011 18:21:08'
0.0.44

6 years ago

0.0.43

6 years ago

0.0.42

6 years ago

0.0.41

6 years ago

0.0.40

6 years ago

0.0.39

6 years ago

0.0.38

6 years ago

0.0.37

7 years ago

0.0.36

7 years ago

0.0.35

8 years ago

0.0.34

8 years ago

0.0.33

8 years ago

0.0.32

8 years ago

0.0.31

8 years ago

0.0.30

8 years ago

0.0.29

8 years ago

0.0.28

8 years ago

0.0.27

8 years ago

0.0.26

8 years ago

0.0.24

8 years ago

0.0.23

8 years ago

0.0.22

8 years ago

0.0.21

8 years ago

0.0.20

8 years ago

0.0.19

8 years ago

0.0.18

8 years ago

0.0.17

8 years ago

0.0.16

8 years ago

0.0.15

8 years ago

0.0.14

8 years ago

0.0.13

8 years ago

0.0.12

8 years ago

0.0.11

8 years ago

0.0.10

8 years ago

0.0.9

8 years ago

0.0.8

8 years ago

0.0.7

8 years ago

0.0.6

8 years ago

0.0.5

8 years ago

0.0.3

8 years ago

0.0.2

8 years ago