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