echo $objDateTime->format('c'); // ISO8601 formated datetime
echo $objDateTime->format(DateTime::ISO8601); // Another way to get an ISO8601 formatted string
class YourModal extends Model
{
public function getCreatedAtAttribute($date)
{
return date(DATE_ISO8601, strtotime($date)); // ISO 8601 Date Format
}
}