What is the best way to convert date from JavaScript string in format YYYYMMDD to JavaScript date?

前端 未结 2 387
深忆病人
深忆病人 2021-01-16 12:13

What is best way to convert date from JavaScript string in format YYYYMMDD to JavaScript date format.

var from_date = document.getElementById(\'from_date\').         


        
2条回答
  •  被撕碎了的回忆
    2021-01-16 12:39

    It's easy, I struggled with the same question but came up with an easier way. Create a hidden div tag and set the date into an attribute. then retrieve the attribute and use the sub string method to get something like Mar 01.

         
         
    

    That's all thanks! check out my operating system: hypertos(dot)webege(dot)com

提交回复
热议问题