Skip to main content
se añadieron 2 caracteres en el cuerpo
Origen Enlace

Tal vez con una función para formatear te sea útil.

function getDateFormat(otherDateFormat)
{
    var date = new Date(otherDateFormat);
    
    var day = addZero(date.getDate());
    var month = addZero(date.getMonth()+1);
    var year = date.getFullYear();
    var hours = addZero(date.getHours());
    var minutes = addZero(date.getMinutes());
    var seconds = addZero(date.getSeconds());
    
    return [day,month,year].join('-') +' '+ [hours,minutes,seconds].join(':');
}

function addZero(i)
{
    if (i < 10) {
        i = "0" + i;
    }
    return i;
}

console.log(getDateFormat('Wed Jun 13 2018 17:53:57 GMT-0600 (Hora verano, Montañas (México))'));

Tal vez con una función para formatear te sea útil.

function getDateFormat(otherDateFormat)
{
    var date = new Date(otherDateFormat);
    
    var day = addZero(date.getDate());
    var month = addZero(date.getMonth());
    var year = date.getFullYear();
    var hours = addZero(date.getHours());
    var minutes = addZero(date.getMinutes());
    var seconds = addZero(date.getSeconds());
    
    return [day,month,year].join('-') +' '+ [hours,minutes,seconds].join(':');
}

function addZero(i)
{
    if (i < 10) {
        i = "0" + i;
    }
    return i;
}

console.log(getDateFormat('Wed Jun 13 2018 17:53:57 GMT-0600 (Hora verano, Montañas (México))'));

Tal vez con una función para formatear te sea útil.

function getDateFormat(otherDateFormat)
{
    var date = new Date(otherDateFormat);
    
    var day = addZero(date.getDate());
    var month = addZero(date.getMonth()+1);
    var year = date.getFullYear();
    var hours = addZero(date.getHours());
    var minutes = addZero(date.getMinutes());
    var seconds = addZero(date.getSeconds());
    
    return [day,month,year].join('-') +' '+ [hours,minutes,seconds].join(':');
}

function addZero(i)
{
    if (i < 10) {
        i = "0" + i;
    }
    return i;
}

console.log(getDateFormat('Wed Jun 13 2018 17:53:57 GMT-0600 (Hora verano, Montañas (México))'));
Origen Enlace

Tal vez con una función para formatear te sea útil.

function getDateFormat(otherDateFormat)
{
    var date = new Date(otherDateFormat);
    
    var day = addZero(date.getDate());
    var month = addZero(date.getMonth());
    var year = date.getFullYear();
    var hours = addZero(date.getHours());
    var minutes = addZero(date.getMinutes());
    var seconds = addZero(date.getSeconds());
    
    return [day,month,year].join('-') +' '+ [hours,minutes,seconds].join(':');
}

function addZero(i)
{
    if (i < 10) {
        i = "0" + i;
    }
    return i;
}

console.log(getDateFormat('Wed Jun 13 2018 17:53:57 GMT-0600 (Hora verano, Montañas (México))'));