Create a date value from a text string

Hello,
Reading the json nfl data file, and one of the fields is the date and time of the game...
date : 2022-09-18T17:00Z

I used ABG's method to get the json item (list by walking key path), now I need to convert to an actual date instance.

Is there a way to convert this to an actual date / time instance, so I can format it the way I would like it displayed ?

In php I used
$format = 'D, F jS h:i a T'; // Thu, September 8th 8:20 PM EDT
$date = DateTimeImmutable::createFromFormat($format, $d);
$date->format('D-- h:i a')
to change the display format to Thu--8:20 pm
Is there a way to translate this to App Inventor ?

Thanks,
Mike

Post a link to it ...

If possible check this utc date to custom format locale date convertor in extension https://community.kodular.io/t/free-utctool-extended-extension/174354?u=still-learning

1 Like

In Ai2, you can extract the year, month, date, hour, minute using the text segment block, since everything is fixed length.
The Clock component has a block to combine all that into an Instant, and blocks to format an Instant.

That Z at the end probably has something to do with time zones, if you want to gild the lily.

1 Like

Thank you. Was being "lazy", was hoping could read from the text. But, I extracted the text and converted date and time to a clock instance, and all worked well.

It was in another message thread.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.