App.date=function(e,t){var u=t?new Date(t*1e3):new Date;var r=function(e,t){if((e=e+"").length<t)return new Array(++t-e.length).join("0")+e;return e};var n=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];var a={1:"st",2:"nd",3:"rd",21:"st",22:"nd",23:"rd",31:"st"};var i=["","January","February","March","April","May","June","July","August","September","October","November","December"];var o={d:function(){return r(o.j(),2)},D:function(){return o.l().substr(0,3)},j:function(){return u.getDate()},l:function(){return n[o.w()]},N:function(){return o.w()+1},S:function(){return a[o.j()]?a[o.j()]:"th"},w:function(){return u.getDay()},z:function(){return(u-new Date(u.getFullYear()+"/1/1"))/864e5>>0},W:function(){var e=o.z(),t=364+o.L()-e;var r,n=(new Date(u.getFullYear()+"/1/1").getDay()||7)-1;if(t<=2&&(u.getDay()||7)-1<=2-t){return 1}else{if(e<=2&&n>=4&&e>=6-n){r=new Date(u.getFullYear()-1+"/12/31");return date("W",Math.round(r.getTime()/1e3))}else{return 1+(n<=3?(e+n)/7:(e-(7-n))/7)>>0}}},F:function(){return i[o.n()]},m:function(){return r(o.n(),2)},M:function(){return o.F().substr(0,3)},n:function(){return u.getMonth()+1},t:function(){var e;if((e=u.getMonth()+1)==2){return 28+o.L()}else{if(e&1&&e<8||!(e&1)&&e>7){return 31}else{return 30}}},L:function(){var e=o.Y();return!(e&3)&&(e%100||!(e%400))?1:0},Y:function(){return u.getFullYear()},y:function(){return(u.getFullYear()+"").slice(2)},a:function(){return u.getHours()>11?"pm":"am"},A:function(){return o.a().toUpperCase()},B:function(){var e=(u.getTimezoneOffset()+60)*60;var t=u.getHours()*3600+u.getMinutes()*60+u.getSeconds()+e;var r=Math.floor(t/86.4);if(r>1e3)r-=1e3;if(r<0)r+=1e3;if(String(r).length==1)r="00"+r;if(String(r).length==2)r="0"+r;return r},g:function(){return u.getHours()%12||12},G:function(){return u.getHours()},h:function(){return r(o.g(),2)},H:function(){return r(u.getHours(),2)},i:function(){return r(u.getMinutes(),2)},s:function(){return r(u.getSeconds(),2)},O:function(){var e=r(Math.abs(u.getTimezoneOffset()/60*100),4);if(u.getTimezoneOffset()>0)e="-"+e;else e="+"+e;return e},P:function(){var e=o.O();return e.substr(0,3)+":"+e.substr(3,2)},c:function(){return o.Y()+"-"+o.m()+"-"+o.d()+"T"+o.h()+":"+o.i()+":"+o.s()+o.P()},U:function(){return Math.round(u.getTime()/1e3)}};return e.replace(/[\\]?([a-zA-Z])/g,function(e,t){if(e!=t){ret=t}else if(o[t]){ret=o[t]()}else{ret=t}return ret})};App.strToTime=function(e){var t=new Date(e),r=t.getTime();if(!isNaN(r))return r;var n=e.replace(/[^\d-]+/g,"-"),u=n.split("-");for(var a=5;a>=0;a--){if(typeof u[a]=="undefined"){u[a]=a>0&&a<3?1:0;continue}break}t=new Date(Date.UTC(u[0],u[1]-1,u[2],u[3]-8,u[4],u[5]));r=t.getTime();return r};App.friendlyDate=function(e,t){var r=function(e){return e<10?"0"+e:e};if(!e)return"";var n=new Date(t*1e3);var u=new Date(e*1e3);var a=t-e;var i=parseInt(n.getDate())-parseInt(u.getDate());var o=parseInt(n.getMonth()+1)-parseInt(u.getMonth()+1);var f=parseInt(n.getFullYear())-parseInt(u.getFullYear());if(a<60){if(a<10)return App.t("刚刚");return parseInt(Math.floor(a/10)*10)+App.t("秒前")}if(a<3600)return parseInt(Math.floor(a/60))+App.t("分钟前");if(f===0&&o===0&&i===0)return App.t("今天")+r(u.getHours())+":"+r(u.getMinutes());if(f===0)return r(u.getMonth()+1)+App.t("月")+r(u.getDate())+App.t("日")+" "+r(u.getHours())+":"+r(u.getMinutes());return u.getFullYear()+"-"+r(u.getMonth()+1)+"-"+r(u.getDate())+" "+r(u.getHours())+":"+r(u.getMinutes())};