random-datetime
v1.0.1
Published
Generate a random date.
Downloads
658
Maintainers
Readme
random-datetime
Generate a random date.
Install
$ npm install --save random-datetime
Usage
var randomDate = require('random-datetime');
// API
// - randomDate([options]);
// options
// - year
// - month
// - day
// - hour
// - minute
// - second
// - millisecond
By default, returns an actual Date object:
randomDate();
// => Tue Jun 11 5399 18:47:58 GMT+0800 (CST)
Can optionally specify defaults for any of year, month, day, hour, minute, second or millisecond:
randomDate({
year: 2004,
month: 4
});
// => Wed Apr 21 2004 10:12:33 GMT+0800 (CST)
Related
- random-year - Generate a random year.
- random-month - Generate a random month.
- random-day - Generate a random day of a month.
- random-hour - Generate a random hour.
- random-minute - Generate a random minute.
- random-second - Generate a random second.
- random-millisecond - Generate a random millisecond.
- random-weekday - Generate a random weekday.
- random-ampm - Return am or pm. Very simple.
- random-timestamps - Generate a timestamp.
- random-hammertime - Generate a random hammertime.
Contributing
Pull requests and stars are highly welcome.
For bugs and feature requests, please create an issue.