Truncate date to 2 decimal places

How do i truncate date to 2 decimal places also remove T? I am using let time = new Date().getTime() but i get time like 1.65839405342T as shown below.
t
I want like 1.65 in millisecond.

Well first of all, I don’t think getTime() gives you something with “T” on the end. Are you sure you are not adding that somewhere?

As for setting it to two decimal places, you can try toFixed(). Here is a stackoverflow thread talking about its uses…

Edit: Be mindful that this will convert the number to a string. Which should be ok for you since you appear to just be displaying it.

i have already tried toFixed() but it does not work

The time (seconds since 1 Jan 1970) right now using new Date().getTime() is 1677357900964

It looks like your figure is being shown as an exponential number, of “1.677357900964e+12” and is being further truncated from there for display.