'from' => $this->faker->dateTime($max = 'now', $timezone = null),
'to' => $this->faker->dateTime($max = 'now', $timezone = null),
In my factory file, I use method dateTime for "from" and "to", but it create with format : yyyy-mm-dd. How can I create value for "from" with format dd-mm-yyyy minute hour second ?
CodePudding user response:
How about the following:
'from' => \Carbon\Carbon::parse($this->faker->dateTime($max = 'now', $timezone = null))->format('d-m-Y H:i:s'),
You can replace - in the format() with / if needed. Also take a look at the Carbon docs to see what other methods are available.
