Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Unknown date format from API response

API Server responds with token expiration date in the following format:
2022-05-09T02:11:27.747
What format is it?

>Solution :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

That’s ISO-8601 standard time format. Year month day T hour minute second millisecond. The date_parse function will handle this.

<?php

$x = '2021-04-01T19:18:17.654';
print_r(date_parse($x));
?>

Output:

Array
(
    [year] => 2021
    [month] => 4
    [day] => 1
    [hour] => 19
    [minute] => 18
    [second] => 17
    [fraction] => 0.654
    [warning_count] => 0
    [warnings] => Array
        (
        )

    [error_count] => 0
    [errors] => Array
        (
        )

    [is_localtime] => 
)
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading