I have seen some "required" formats where they need the literal 'Z' character at the end to represent it is in UTC. In that case, you could put single quotes (') around the Z like this:
var utcTimeFormat = new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS'Z'");
To produce something like this: 2021-09-01 14:00:00.000Z
This only makes sense if you are setting the TimeZone to UTC as this example is doing.