Strange string concatenation

Vlad 0 Reputation points
2023-11-24T16:51:33.4033333+00:00

I have an Office Script where I have a date/time string that I would like to convert to canonical view (inside Power Automate).

So I tried this code:

let date = "2023-11-20 03:00:04";
let canonic_date = date.substr(0, 10) + "T" + date.substr(11, 8) + ".000Z"

To my surprise I got "2023-11-20T03:00:04Z" in canonic_date variable. I tried to use concat() function and got the same result.

If I do this kind of thing

let date = "2023-11-20 03:00:04";
let canonic_date = date.substr(0, 10) + "T" + date.substr(11, 8) + "X.000Z"

Then I have expected value "2023-11-20T03:00:04X.000Z"

What is wrong with ".000Z" addition? Why it doesn't work?

Office Development
Office Development
Office: A suite of Microsoft productivity software that supports common business tasks, including word processing, email, presentations, and data management and analysis.Development: The process of researching, productizing, and refining new or existing technologies.
3,709 questions
0 comments No comments
{count} votes