How to split the following date in jav开发者_开发知识库ascript,
 var date='2002-01-01';
   The result should be as 20020101
Thanks..
var date = "2002-01-01";
Either of the following will get you what you want:
- date = date.replace(/-/g, "");
- date = date.split("-").join("");
If it is just a string, you can do:
var date = ("2002-01-02").replace(/-/g, "");
Otherwise:
var now = new Date();
var date = now.getFullYear() + "" + (now.getMonth() + 1) + "" + now.getDate();
 
         
                                         
                                         
                                         
                                        ![Interactive visualization of a graph in python [closed]](https://www.devze.com/res/2023/04-10/09/92d32fe8c0d22fb96bd6f6e8b7d1f457.gif) 
                                         
                                         
                                         
                                         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论