DEV Community

loading...

Discussion on: Two string methods every JavaScript developer should know.

Collapse
brandito profile image
brandito

Haha turns out substr would get the T not the Z and substring would get the correct string with the same args

Thread Thread
lnshimmell profile image
LNShimmell

Both of you are wrong but okay... it would not get either.

date= '"2019-08-02T00:00:00.000Z"';
console.log(date.substr(1,11);

go ahead and run in your console. I'll wait.

Thread Thread
brandito profile image
brandito