mirror of
https://github.com/jikan-me/jikan-rest.git
synced 2025-02-20 11:23:35 +08:00
19 lines
369 B
PHP
19 lines
369 B
PHP
<?php
|
|
|
|
namespace App;
|
|
|
|
trait IsoDateFormatter
|
|
{
|
|
protected function formatIsoDateTime(string $d): string
|
|
{
|
|
$dt = explode('-', $d);
|
|
return (new \DateTime())
|
|
->setDate(
|
|
$dt[0] ?? date('Y'),
|
|
$dt[1] ?? 1,
|
|
$dt[2] ?? 1
|
|
)
|
|
->format(\DateTimeInterface::ISO8601);
|
|
}
|
|
}
|