Javascript Date Plus 2 Weeks (14 days)

后端 未结 8 1773
孤街浪徒
孤街浪徒 2020-12-05 17:00

I use this to get the date:

var currentTime = new Date()
var month = currentTime.getMonth() + 1
var day = currentTime.getDate()
var year = currentTime.getFu         


        
8条回答
  •  生来不讨喜
    2020-12-05 17:51

    If you are formatting a javascript date in a particular format, then I think you can have a look at this script http://blog.stevenlevithan.com/archives/date-time-format. All you would need to do after including the script is this new Date(+new Date + 1000* 60 * 60 * 24 * 14).format('dd/mm/yyyy') and you would get the output "27/10/2011"

    The script is pretty small, just above 1KB minified. This is the link to a working fiddle http://jsfiddle.net/naryad/GufvT/

提交回复
热议问题