# Create and array of all the dates between a start and end date with CarbonPeriod

> Today I Learned by Graffino: short tips and tricks our team discovers in everyday work on code, web development, DevOps and sysops.

- URL: https://graffino.com/til/create-and-array-of-all-the-dates-between-a-start-and-end-date-with-carbonperiod
- Author: Nick Ciolpan
- Channel: php
- Published: 2022-12-08
- Updated: 2022-12-08

```
...
$period = CarbonPeriod::create($startDate, $endDate);

foreach ($period as $date) {
	$date->format('Y-m-d');
}

$dates = $period->toArray();
```
