Convert ISO 8601 Date and time Into A Useable Date

I have a date time in a variable: 2025-04-14T04:00:00Z
I don't THINK I can reformat that in KM (as a date) in that format

How can I convert that so I can reformat it in KM as: Monday 4/14 4 AM

This is probably solved easily using the information on the following page.

https://wiki.keyboardmaestro.com/token/ICUDateTime

I'm reading the page now to see if I can solve it for you.

1 Like

Probably not the most efficient, but I can make it work this way
Use the substring method to get each part from the 8601 date into a separate variable
(Year, Month, Day, Time)
Then use those variables to build what I want with TIME()

%ICUDateTimeFor% TIME(Year, Month, Day, Time,0,0) %EEEE M/d h a%

Well, if you want to break it up manually, you can try this:

image

And if you follow the above action with the following, it seems to work:

image

Although I thought there would be a way to do it in a single step, but if this works, that's good enough.

1 Like

Thanks!
Using the Search Variable with regex is cleaner so I used that

The only other thing I needed to add was GMTOFFSET() because I have a negative GMT offset

%ICUDateTimeFor% TIME(Year, Month, Day, Hour,0,0)-GMTOFFSET() %EEEE M/d h a%

1 Like

And another approach is to get the ICU Date Time from the Unix seconds:

Unix Seconds and ICUDateTime from ISO8601.kmmacros (4.1 KB)

1 Like

Oh, nice, thanks!

1 Like

See also, more generally:

1 Like