Friday, May 21, 2021

Javascript how turn Ymd date to an another format

 Say date as Ymd: 20010112 full int, how turn it to a form 12.1.2001, no loops.

               %- Modulo our friend here



var day= 20010112%100; // es 12


var month=((20010112-day)/100)%100; // month 1


var year= (((20010112-day)/100) -month)/100; //year 2001


//now


console.log(day+"."+month+"."+year); //behold 12.1.2001

No! loop that sure.

No comments:

Post a Comment

3D BLog has return

Go  to Check    https://thereal3dblog.com/