Question

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)
Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top