util.timestamp
Generates a string timestamp
Last updated 4 months ago by jmquigley .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install util.timestamp 
SYNC missed versions from official npm registry.

util.timestamp

Generates a string timestamp

build analysis code style: prettier testing NPM coverage

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'

Current Tags

  • 0.0.42                                ...           latest (4 months ago)

39 Versions

  • 0.0.42                                ...           4 months ago
  • 0.0.41                                ...           4 months ago
  • 0.0.40                                ...           5 months ago
  • 0.0.39                                ...           5 months ago
  • 0.0.38                                ...           6 months ago
  • 0.0.37                                ...           a year ago
  • 0.0.36                                ...           a year ago
  • 0.0.35                                ...           2 years ago
  • 0.0.34                                ...           2 years ago
  • 0.0.33                                ...           2 years ago
  • 0.0.32                                ...           2 years ago
  • 0.0.31                                ...           2 years ago
  • 0.0.30                                ...           2 years ago
  • 0.0.29                                ...           2 years ago
  • 0.0.28                                ...           2 years ago
  • 0.0.27                                ...           2 years ago
  • 0.0.26                                ...           2 years ago
  • 0.0.24                                ...           2 years ago
  • 0.0.23                                ...           2 years ago
  • 0.0.22                                ...           2 years ago
  • 0.0.21                                ...           2 years ago
  • 0.0.20                                ...           2 years ago
  • 0.0.19                                ...           2 years ago
  • 0.0.18                                ...           2 years ago
  • 0.0.17                                ...           2 years ago
  • 0.0.16                                ...           2 years ago
  • 0.0.15                                ...           2 years ago
  • 0.0.14                                ...           2 years ago
  • 0.0.13                                ...           2 years ago
  • 0.0.12                                ...           2 years ago
  • 0.0.11                                ...           2 years ago
  • 0.0.10                                ...           2 years ago
  • 0.0.9                                ...           2 years ago
  • 0.0.8                                ...           2 years ago
  • 0.0.7                                ...           2 years ago
  • 0.0.6                                ...           2 years ago
  • 0.0.5                                ...           2 years ago
  • 0.0.3                                ...           2 years ago
  • 0.0.2                                ...           2 years ago
Maintainers (1)
Downloads
Today 0
This Week 1
This Month 41
Last Day 0
Last Week 1
Last Month 78
Dependencies (1)
Dev Dependencies (18)

Copyright 2014 - 2016 © taobao.org |