---
title: "自定义获取指定日期"
author: "ausdin"
date: "2011-10-27T16:25:27Z"
tags: ["js 指定日期"]
categories: ["Web前端"]
slug: "untitled"
draft: false
lastmod: "2011-11-02T09:59:10Z"
id: 1218727
url: "https://ausdin.iteye.com/blog/1218727"
---

```js

//获取day天后的日期:格式为2010-1-1
Date.prototype.calculateDate = function(day) {
	this.setDate(this.getDate() + day);  //计算新日期
	return this.getFullYear() + '-' + (this.getMonth() + 1) + '-' + this.getDate();
}
```