如何使用JSON API插件1.0.7解析日期格式?

如何使用JSON API插件1.0.7解析日期格式?,json,wordpress,Json,Wordpress,我正在使用JSON API插件在我的移动网站上显示我的博客文章。我已经让一切按我所希望的方式工作,但是日期以这种格式显示: 2012-03-21 20:03:30 然而,我希望它像这样显示。或者类似的东西 March 21, 2012 这是我用来显示博客帖子的Javascript: var MYBLOG_LIMIT = 7; var MYWRAPPER_CLASS = 'homeblog'; var WP={open:function(b){var a={posts:

我正在使用JSON API插件在我的移动网站上显示我的博客文章。我已经让一切按我所希望的方式工作,但是日期以这种格式显示:

 2012-03-21 20:03:30
然而,我希望它像这样显示。或者类似的东西

 March 21, 2012
这是我用来显示博客帖子的Javascript:

 var MYBLOG_LIMIT = 7;
    var MYWRAPPER_CLASS = 'homeblog';

    var WP={open:function(b){var a={posts:function(){var d=MYBLOG_LIMIT;var e=0;var c={all:function(g){var f=b+"/api/get_recent_posts/";f+="?count="+d+"&page="+e+"&callback=?";jQuery.getJSON(f,function(l){var k=l.posts;for(var j=0;j<k.length;j++){var h=k[j];h.createComment=function(i,m){i.postId=h.id;a.comments().create(i,m)}}g(k)})},findBySlug:function(f,h){var g=b+"/api/get_post/";g+="?slug="+f+"&callback=?";jQuery.getJSON(g,function(i){h(i.post)})},limit:function(f){d=f;return c},page:function(f){e=f;return c}};return c},pages:function(){var c={findBySlug:function(d,f){var e=b+"/api/get_page/";e+="?slug="+d+"&callback=?";jQuery.getJSON(e,function(g){f(g.page)})}};return c},categories:function(){var c={all:function(e){var d=b+"/api/get_category_index/";d+="?callback=?";jQuery.getJSON(d,function(f){e(f.categories)})}};return c},tags:function(){var c={all:function(e){var d=b+"/api/get_tag_index/";d+="?callback=?";jQuery.getJSON(d,function(f){e(f.tags)})}};return c},comments:function(){var c={create:function(f,e){var d=b+"/api/submit_comment/";d+="?post_id="+f.postId+"&name="+f.name+"&email="+f.email+"&content="+f.content+"&callback=?";jQuery.getJSON(d,function(g){e(g)})}};return c}};return a}};

var blog = WP.open('http://www.endofphotography.com/');

    blog.posts().all(function(posts){
        for(var i = 0; i < posts.length; i++){
            jQuery('.'+MYWRAPPER_CLASS).append(function(){
        return (posts[i].content) ? '<div class="lastpost_title" href="'+posts[i].url+'"><h4>'+posts[i].title+'</h4></div><div href="'+posts[i].url+'">'+posts[i].content+'<br>'+posts[i].date+'</div><br><hr><br>' : '<div href="'+posts[i].url+'"><h4>'+posts[i].date+'</h4></div>';
     });
   }
 });
var MYBLOG_LIMIT=7;
var MYWRAPPER_CLASS='homeblog';

var WP={open:function(b){var a={posts:function(){var d=MYBLOG_LIMIT;var e=0;var c={all:function(g){var f=b+”/api/get_recently__posts/“f+=”?count=“+d+”&page=“+e+”&callback=”;jQuery.getJSON 在移动设备上工作有问题,但这是AJAX的问题

$.getJSON('http://feed_url/?json=get_post&post_id=' + id + '&callback=?', function(data) {
   var output='';
   var date = data.post.date;
   var date = $.format.date(date, "MM/dd/yyyy");
   output += '<em>' + data.post.date + '</em>';
});
$.getJSON('http://feed_url/?json=get_post&post_id=“+id+”&回调=?”,函数(数据){
var输出=“”;
var日期=data.post.date;
变量日期=$.format.date(日期,“MM/dd/yyyy”);
输出+=''+data.post.date+'';
});
你的会看起来像:
var date=$.format.date(date,“ddd d,yyyyy”);

我最近尝试在一个web应用程序中使用此脚本,在该应用程序中,我使用JSON插件动态显示帖子,但不幸的是,此脚本无法正常工作。不过,此脚本应该可以正常工作。如果它不正确,则非常接近。也许有一天我会最终解决它。