Angad Dubey Angad Dubey - 2 years ago 149
PHP Question

How to get future date in Faker

How do I get future dates with:

dateTime($max = 'now')

i.e. what should the $max value be for datetime in the future

Answer Source

Try passing a unix timestamp for $max.

$unixTimestap = '1461067200'; // = 2016-04-19T12:00:00+00:00 in ISO 8601

echo $faker->dateTime($unixTimestamp);

echo $faker->date('Y-m-d', $unixTimestamp);

// for all rows 
$faker->dateTimeBetween('now', $unixTimestamp);
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download