How to get year/month/day from a date object?

前端 未结 16 1106
暗喜
暗喜 2020-11-28 17:52

alert(dateObj) gives Wed Dec 30 2009 00:00:00 GMT+0800

How to get date in format 2009/12/30?

16条回答
  •  天命终不由人
    2020-11-28 18:46

    Nice formatting add-in: http://blog.stevenlevithan.com/archives/date-time-format.

    With that you could write:

    var now = new Date();
    now.format("yyyy/mm/dd");
    

提交回复
热议问题