var data = '2016-12-08 00:00:00.0'; var dataFormatada = data.replace(/(d*)-(d*)-(d*).*/, '$1-$2-$3'); console.log(dataFormatada);