11. First parse the created_at field as Carbon object.
2 $createdAt = Carbon::parse($item['created_at']);
3
42.Then you can use
5 $suborder['payment_date'] = $createdAt->format('M d Y');
1
2$dt = Carbon::parse($data->created_at) //from database
3
4echo $dt->toDateTimeString(); // 2012-01-31 00:00:00
5
6echo $dt->addYears(5); // 2017-01-31 00:00:00
7echo $dt->addYear(); // 2018-01-31 00:00:00
8echo $dt->subYear(); // 2017-01-31 00:00:00
9echo $dt->subYears(5); // 2012-01-31 00:00:00
10
11echo $dt->addMonths(60); // 2017-01-31 00:00:00
12echo $dt->addMonth(); // 2017-03-03 00:00:00 equivalent of $dt->month($dt->month + 1); so it wraps
13echo $dt->subMonth(); // 2017-02-03 00:00:00
14echo $dt->subMonths(60); // 2012-02-03 00:00:00
15
16echo $dt->addDays(29); // 2012-03-03 00:00:00
17echo $dt->addDay(); // 2012-03-04 00:00:00
18echo $dt->subDay(); // 2012-03-03 00:00:00
19echo $dt->subDays(29); // 2012-02-03 00:00:00
20
21echo $dt->addWeekdays(4); // 2012-02-09 00:00:00
22echo $dt->addWeekday(); // 2012-02-10 00:00:00
23echo $dt->subWeekday(); // 2012-02-09 00:00:00
24echo $dt->subWeekdays(4); // 2012-02-03 00:00:00
25
26echo $dt->addWeeks(3); // 2012-02-24 00:00:00
27echo $dt->addWeek(); // 2012-03-02 00:00:00
28echo $dt->subWeek(); // 2012-02-24 00:00:00
29echo $dt->subWeeks(3); // 2012-02-03 00:00:00
30
31echo $dt->addHours(24); // 2012-02-04 00:00:00
32echo $dt->addHour(); // 2012-02-04 01:00:00
33echo $dt->subHour(); // 2012-02-04 00:00:00
34echo $dt->subHours(24); // 2012-02-03 00:00:00
35
36echo $dt->addMinutes(61); // 2012-02-03 01:01:00
37echo $dt->addMinute(); // 2012-02-03 01:02:00
38echo $dt->subMinute(); // 2012-02-03 01:01:00
39echo $dt->subMinutes(61); // 2012-02-03 00:00:00
40
41echo $dt->addSeconds(61); // 2012-02-03 00:01:01
42echo $dt->addSecond(); // 2012-02-03 00:01:02
43echo $dt->subSecond(); // 2012-02-03 00:01:01
44echo $dt->subSeconds(61); // 2012-02-03 00:00:00