How to convert ISO8601 date to YYYY-MM-DD

Hi, i have response from the server with date and time format (ISO8610):
“2023-08-18T23:00:00-05:00”

How i can extract only 2023-08-18 from this response?

Are you converting in a script, or a Formula field?

I’m using a script.
I was able to have it work,
datePartPU = timestampPU.split(“T”)[0]

where timestampPU=“2023-08-18T23:00:00-05:00”