Created
January 28, 2019 14:22
-
-
Save kylekatarnls/a3bd1799acd138bf75597c973f936436 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$inputDateString = '2018-05-12 23:16:46.123456'; // get from DB or some API | |
$jsonFormat = 'Y-m-d\TH:i:s.u\Z'; | |
$start = new DateTimeImmutable($inputDateString); | |
$end = $start->modify('+2 days'); | |
echo json_encode([ | |
'title' => 'Foobar', | |
'start' => $start->format($jsonFormat), | |
'end' => $end->format($jsonFormat), | |
]); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment