How to change date format using jQuery?

前端 未结 4 1096
长情又很酷
长情又很酷 2020-12-15 07:31

I have a date in a format like this fecha2.value = \'2014-01-06\', but I want to change the format to this \'01-06-14\' using jQuery.

How c

4条回答
  •  一整个雨季
    2020-12-15 08:24

    var d = new Date();
    
    var curr_date = d.getDate();
    
    var curr_month = d.getMonth();
    
    var curr_year = d.getFullYear();
    
    curr_year = curr_year.toString().substr(2,2);
    
    document.write(curr_date+"-"+curr_month+"-"+curr_year);
    

    You can change this as your need..

提交回复
热议问题