Angad Dubey Angad Dubey - 1 year ago 82
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);