How to change date format using jQuery?

前端 未结 4 1100
长情又很酷
长情又很酷 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:13

    You don't need any date-specific functions for this, it's just string manipulation:

    var parts = fecha2.value.split('-');
    var newdate = parts[1]+'-'+parts[2]+'-'+(parseInt(parts[0], 10)%100);
    

提交回复
热议问题