Data::Fake::Dates - Fake date data generators
version 0.003
use Data::Fake::Dates; $past = fake_past_epoch()->(); $future = fake_future_epoch()->(); $past = fake_past_datetime()->(); # ISO-8601 UTC $future = fake_future_datetime()->(); # ISO-8601 UTC $past = fake_past_datetime("%Y-%m-%d")->(); $future = fake_future_datetime("%Y-%m-%d")->();
This module provides fake data generators for past and future dates and times.
All functions are exported by default.
$generator = fake_past_epoch();
This returns a generator that gives a randomly-selected integer number of seconds between the Unix epoch and the current time.
$generator = fake_future_epoch();
This returns a generator that gives a randomly-selected integer number of seconds between the the current time and a period as far into the future as the Unix epoch is in the past (i.e. about 45 years as of 2015).
$generator = fake_past_datetime(); $generator = fake_past_datetime("%Y-%m-%d"); $generator = fake_past_datetime($strftime_format);
This returns a generator that selects a past datetime like fake_past_epoch does but formats it as a string using FreeBSD-style strftime formats. (See Time::Piece for details.)
fake_past_epoch
strftime
The default format is ISO8601 UTC "Zulu" time (%Y-%m-%dT%TZ).
%Y-%m-%dT%TZ
$generator = fake_future_datetime(); $generator = fake_future_datetime("%Y-%m-%d"); $generator = fake_future_datetime($strftime_format);
This returns a generator that selects a future datetime like fake_future_epoch does but formats it as a string using FreeBSD-style strftime formats. (See Time::Piece for details.)
fake_future_epoch
David Golden <dagolden@cpan.org>
This software is Copyright (c) 2015 by David Golden.
This is free software, licensed under:
The Apache License, Version 2.0, January 2004
To install Data::Fake, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Data::Fake
CPAN shell
perl -MCPAN -e shell install Data::Fake
For more information on module installation, please visit the detailed CPAN module installation guide.