S
S
svilkov872018-08-10 11:54:10
JavaScript
svilkov87, 2018-08-10 11:54:10

How to replace the last four digits if such a match occurs?

There is such a line: I cannot solve the following problem: If there are four zeros at the end of the string, then you need to reduce them (replace, probably) to two.
var $time = '21:32:13.210000';

Answer the question

In order to leave comments, you need to log in

2 answer(s)
0
0xD34F, 2018-08-10
@svilkov87

$time.replace(/0{4}$/, '00')

I
ixon, 2018-08-10
@ixon

$time.split(".")[0]+"."+$time.split(".")[1].replace(/0{4}$/, '00')

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question