Вопрос

I have this string and I want to create a filter to cut the last 10 chars

thanks

var date ="2014-04-15T07:00:00.000Z";

date = str.slice(0,10)
Это было полезно?

Решение

var date ="2014-04-15T07:00:00.000Z";
date = date.substring(0, date.length - 10);

removes the last 10 characters of variable date and returns "2014-04-15T07:".

Fiddle.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top