JS 获取时间
2015-10-30 11:00
597 查看
//获取当前月的第一天
function getFirstDayInCurrtMonth() {
var date = new Date()
with (date) {
year = date.getYear() + 1900;
month = date.getMonth() + 1;
}
return year + "-" + month + "-1" + " 00:00:00";
}
//获取下个月的第一天
function getFirstDayInNextMonth() {
var date = new Date()
with (date) {
year = date.getYear() + 1900;
month = date.getMonth() + 2;
}
return year + "-" + month + "-1" + " 00:00:00";
}
//获取当前月的最后一天
function getLastDayInCurrMonth() {
var date = new Date()
with (date) {
year = date.getYear() + 1900;
month = date.getMonth() + 1;
}
var day = new Date(year, month, 0);
return year + '-' + month + '-' + day.getDate() + " 23:59:59";//获取当月最后一天日期
}
function getFirstDayInCurrtMonth() {
var date = new Date()
with (date) {
year = date.getYear() + 1900;
month = date.getMonth() + 1;
}
return year + "-" + month + "-1" + " 00:00:00";
}
//获取下个月的第一天
function getFirstDayInNextMonth() {
var date = new Date()
with (date) {
year = date.getYear() + 1900;
month = date.getMonth() + 2;
}
return year + "-" + month + "-1" + " 00:00:00";
}
//获取当前月的最后一天
function getLastDayInCurrMonth() {
var date = new Date()
with (date) {
year = date.getYear() + 1900;
month = date.getMonth() + 1;
}
var day = new Date(year, month, 0);
return year + '-' + month + '-' + day.getDate() + " 23:59:59";//获取当月最后一天日期
}
相关文章推荐
- 任意修改网页内容JS代码
- JS URL传中文参数引发的乱码问题
- Javascript模块化编程3:require.js的用法
- Can I use a JavaScript Alert box to show a countdown timer?
- Javascript模块化编程2:AMD规范
- js关闭当前页面比较兼容的办法
- Javascript模块化编程 1 :模块的写法
- js基础知识集锦
- javascript 学习总结(六)RegExp对象
- 关于WEBAPI传输JSON的效率测试
- html中使用js进行登录md5加密提交并重定向新页面
- js中单选,反选,联动选择等等
- js对已经对象类型进行类型辨别
- javascript基本语法
- js的prototype属性
- cookie.js插件的README/cookie.js中文使用手册
- javascript学习心得
- 自己动手写的javascript前端等待控件
- Js获取当前日期时间及其它操作
- 处理将list 转换为json,js时间显示毫秒数问题