我如何获得未来日期:
https://github.com/fzaninotto/Faker#fakerproviderdatetime
dateTime($max = 'now')
Run Code Online (Sandbox Code Playgroud)
即$ max值应该是将来的日期时间
小智 35
您可以将strtotime字符串条件传递给$faker->dateTimeBetween().
//ranging from today ending in 2 years
$faker->dateTimeBetween('+0 days', '+2 years')
//ranging from next week ending in 1 month
$faker->dateTimeBetween('+1 week', '+1 month')
//ranging from next sunday to next wednesday (if today is wednesday)
$faker->dateTimeBetween('next sunday', 'next wednesday')
Run Code Online (Sandbox Code Playgroud)
请参阅http://php.net/manual/en/function.strtotime.php以获取字符串用法和组合的完整列表.
Jen*_*och 17
尝试传递一个unix时间戳$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);
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
15162 次 |
| 最近记录: |