尝试使用Google云端硬盘REST API格式化日期时遇到问题...当我从api获得 createdDate
时,它会显示2015-10-12T03:38:15.813Z
如何将格式从2015-10-12T03:38:15.813Z
更改为12 October 2015
???
$.ajax({
type: "GET",
url: "https://www.googleapis.com/drive/v2/files/0B3hR6CXw7JStd3JaMFljTzRyOGc?key=AIzaSyDoMD79fdW7fC8SOlgxFIH5bxTn2EBQ87E",
dataType: "json",
success: function(result) {
$('#date').text(result.createdDate);
}
});

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<span id='date'></span>
&#13;
答案 0 :(得分:0)
像这样使用jquery datepicker。
var date=yourdate.substr(0, yourdate.indexOf('T');
$.datepicker.formatDate('M dd, yy', new Date(date);