export const getDate = (str) => {
    let dateReg = /\w{4}\-\w{1,2}\-\w{1,2}/ig;
    let r = dateReg.test(str);
    if(!r) {
        return;
    };
    let date = new Date(str);
    let year = date.getFullYear();
    let month = fill(date.getMonth()+1);
    let getDate = fill(date.getDate());
    let hour = fill(date.getHours());
    let miunte = fill(date.getMinutes());
    let second = fill(date.getSeconds());
    return `${year}-${month}-${getDate} ${hour}:${miunte}:${second}`;
}

const fill = (num) => {
    return num<10?'0'+num:num;
}
