日期样式“yyyy-MM-dd”
2018-01-18 09:55
190 查看
如何写2018-01-23,而不是2018-1-23
获取本年 var year=new Date().getFullYear() ;
获取本月 var month = new Date().getMonth() + 1 < 10 ? "0" + (new Date().getMonth() + 1) : new Date().getMonth() + 1;
获取本日 var day = new Date().getDate() < 10 ? "0" + new Date().getDate() : new Date().getDate();
赋值 $("#date").html(year+'-'+month+'-'+day);
获取本年 var year=new Date().getFullYear() ;
获取本月 var month = new Date().getMonth() + 1 < 10 ? "0" + (new Date().getMonth() + 1) : new Date().getMonth() + 1;
获取本日 var day = new Date().getDate() < 10 ? "0" + new Date().getDate() : new Date().getDate();
赋值 $("#date").html(year+'-'+month+'-'+day);
相关文章推荐
- js中将数字格式的日期化为yyyy-MM-dd样式
- 模板中将数字格式的日期化为yyyy-MM-dd样式
- js中将数字格式的日期化为yyyy-MM-dd样式
- element-ui 时间日期选择器格式化为yyyy-mm-dd格式
- JAVA中判断是否是正确的日期格式(yyyy-mm-dd)
- Json日期格式 转化为 YYYY-MM-DD-hh-mm-ss
- 正则表达式实现将MM/DD/YYYY格式的日期转换为YYYY-MM-DD格式
- 在EL表达式或者Struts标签库中格式化日期对象,即将Date转换为yyyy-MM-dd格式
- 判斷日期,輸出成YYYY/MM/DD形式
- js获取上一个月、下一个月格式为yyyy-mm-dd的日期
- 使用javascript+正则表达式判断输入日期是否为yyyy-mm-dd
- js angular 时间戳转换成日期格式 年月日 yyyy-MM-dd
- javascript 获取当前日期(YYYY-MM-DD)
- 如何把日期进行格式化,把看不懂的日期转换成形式如yyyy-MM-dd的形式
- yyyy-MM-dd EEE hh:mm:ss(日期转换)
- 简单设置让EasyUI显示中文,日期选择框格式为yyyy-MM-dd格式
- js 字符串日期 yyyy-MM-dd 转化为 date
- js字符串日期yyyy-MM-dd转化为date示例代码
- maximo 中修改日期的格式为yyyy-mm-dd
- sql函数日期格式化为yyyy-mm-dd