dateFunction.js 340 Bytes
Newer Older
1
2
3
export function getDate () {
    const date = new Date();
    const tempY = date.getFullYear();
4
    let tempM = date.getMonth()+1;
5
6
7
    tempM = tempM > 9 ? tempM : "0" + tempM;
    let tempD = date.getDate();
    tempD = tempD > 9 ? tempD : "0" + tempD;
8
    console.log(`${tempY}-${tempM}-${tempD}`)
9
10
    return `${tempY}-${tempM}-${tempD}`
}