Random::Day::InThePast - Class for random day generation in the past.
use Random::Day::InThePast; my $obj = Random::Day::InThePast->new(%params); my $dt = $obj->get; my $dt = $obj->random; my $dt = $obj->random_day($day); my $dt = $obj->random_day_month($day, $month); my $dt = $obj->random_day_month_year($day, $month, $year); my $dt = $obj->random_month($month); my $dt = $obj->random_month_year($month, $year); my $dt = $obj->random_year($year);
new
my $obj = Random::Day::InThePast->new(%params);
Constructor.
day
Day.
Default value is undef.
dt_from
DateTime object from.
Default value is DateTime object for 1900 year.
month
Month.
year
Year.
get
my $dt = $obj->get;
Get random date defined by constructor parameters.
Returns DateTime object for date.
random
my $dt = $obj->random;
Get random date.
random_day
my $dt = $obj->random_day($day);
Get random date defined by day.
random_day_month
my $dt = $obj->random_day_month($day, $month);
Get random date defined by day and month.
random_day_month_year
my $dt = $obj->random_day_month_year($day, $month, $year);
Get date defined by day, month and year.
random_month
my $dt = $obj->random_month($month);
Get random date defined by month.
random_month_year
my $dt = $obj->random_month_year($month, $year);
Get random date defined by month and year.
random_year
my $dt = $obj->random_year($year);
Get random date defined by year.
new(): From Class::Utils::set_params(): Unknown parameter '%s'. random_day(): From Random::Day::random_day(): Day cannot be a zero. Day isn't number. random_day_month(): From Random::Day::random_day_month(): Cannot create DateTime object. Day cannot be a zero. Day isn't number. random_day_month_year(): From Random::Day::random_day_year(): Cannot create DateTime object. Error: %s Day cannot be a zero. Day isn't number. random_month(): From Random::Day::random_momth(): Cannot create DateTime object. Error: %s random_month_year(): From Random::Day::random_month_year(): Begin of expected month is lesser than minimal date. Expected year: %s Expected month: %s Minimal year: %s Minimal month: %s Cannot create DateTime object. Error: %s End of expected month is greater than maximal date. Expected year: %s Expected month: %s Maximal year: %s Maximal month: %s random_year(): From Random::Day::random_year(): Year is greater than maximal year. Expected year: %s Maximal year: %s Year is lesser than minimal year. Expected year: %s Minimal year: %s
use strict; use warnings; use Random::Day::InThePast; # Object. my $obj = Random::Day::InThePast->new; # Get date. my $dt = $obj->get; # Print out. print $dt->ymd."\n"; # Output like: # \d\d\d\d-\d\d-\d\d
Random::Day, DateTime.
Perl module to generate random data
Class for random day generation.
Class for random day generation in the future.
https://github.com/michal-josef-spacek/Random-Day
Michal Josef Špaček mailto:skim@cpan.org
http://skim.cz
© 2013-2024 Michal Josef Špaček
BSD 2-Clause License
0.14
To install Random::Day, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Random::Day
CPAN shell
perl -MCPAN -e shell install Random::Day
For more information on module installation, please visit the detailed CPAN module installation guide.