javascript - 将日期格式化为 "M d, yy"

标签 javascript jquery jquery-ui

我想将 newDate 格式化为 Dec 24, 2013 格式,目前类似于 2013 年 12 月 24 日星期二 00:00:00 GMT+0530

var dateString = 'Dec 17, 2013'; // date string
var actualDate = new Date(dateString); // convert to actual date
var newDate = new Date(actualDate.getFullYear(), actualDate.getMonth(), actualDate.getDate()+7);

alert(dateString);

alert(newDate);

fiddle :http://jsfiddle.net/7eRXh/1/

最佳答案

希望这对您有帮助。更多请引用这个document

$.datepicker.formatDate('M d, yy', 
new Date(),
{ monthNamesShort: ['Jan','Feb','Mar','Apr','Maj','Jun','Jul',
                  'Aug','Sep','Okt','Nov','Dec'] 
});

关于javascript - 将日期格式化为 "M d, yy",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20633793/

相关文章:

javascript - JQueryUI 可排序 : Allow sorting only to second list but not back to first

javascript - Save() 和 Restore() 函数不起作用?

jquery - 确定 IE8 及更低版本的 JSON 中解析的内容

jQuery UI 通过拖放添加选项卡

javascript - 在 jqGrid 中自定义添加/编辑对话框

javascript - 遍历嵌套的 json 数组

javascript - Chart.js 2.0 中水平条之间的奇怪线条

jquery - Twitter Bootstrap v2.3.2 响应式菜单在 IE 或 Safari 或移动设备中不起作用

jquery - 如何使用greasemonkey脚本从互联网下载图像?

jquery-ui - 垂直滚动后jQueryUI Dialog定位