Remove "Z" from datetime


#1

Hi,
I need to return a datetime in this format 2019-02-14T10:50:44.000 instead of 2019-02-14T10:50:44.000Z

how I can solve it?

thanks


#2

Since you are dealing with a string, you can simply do:

var stringDate = date.slice(0, 23);

#3

@gdellefontane1 Keep in mind that removing the “Z” actually changes the meaning of the value. With the “Z” it is a time in UTC. Without it, it’s just a wall clock time without any TZ info. If the field is supposed to store a time without TZ info then you can declare it as:

myField: datetime no tz

Then, it will not be samed with or returned with any TZ info (e.g. the “Z” will not be present).


#4

Ok, thank you for the explanation, I will keep it in mind