// 设置时间格式 2016-10-20 17:41:03
 function getNowFormatDate(timeDate){
        var date = new Date(timeDate);
        var seperator1 = "-";
        var seperator2 = ":";
        var year = date.getFullYear();
        var month = date.getMonth() + 1;
        var strDate = date.getDate();
        var hours = date.getHours();
        var mins = date.getMinutes();
        var ms = date.getSeconds();
        if (month >=1 && month <=9){
            month = '0' + month;
        if (strDate >= 1 && strDate <= 9){
            strDate = '0' + strDate;
        if (hours >= 0 && hours <=9){
            hours = '0' + hours;
        if (mins >= 0 && mins <=9){
            mins = '0' + mins;
        if (ms >= 0 && ms <=9){
            ms = '0' + ms;
        var currentdate = year + seperator1 + month + seperator1 + strDate
            + " " + hours + seperator2 + mins + seperator2 + ms;
        return currentdate;
// 时间格式化
   function timeFormat(timeDate, type){
       if("" == timeDate || null == timeDate){
           return "";
       else if ("mins" == type){
           return timeDate / 60 / 1000;
       else if ("date" == type){
           return getNowFormatDate(timeDate);
       else{
           return timeDate;
                    // 设置时间格式 2016-10-20 17:41:03 function getNowFormatDate(timeDate){        var date = new Date(timeDate);        var seperator1 = "-";        var seperator2 = ":";        var year = date.getFullYea
 //前端传入参数格式
 @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
 //后端返回参数格式, timezone = "GMT+8" 是因为linux时间和windows差8个小时
 @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
SimpleDateFormat 
JsonFormat来源于jackson,Jackson是一个简单基于Java应用库,Jackson可以轻松的将Java对象转换成json对象和xml文档,同样也可以将json、xml转换成Java对象
1、 @JsonFormat不仅可以完成String转时间类型,也可以完成时间类型转string,可双向转换
2、@JsonFormat注解的作用就是完成json字符串到java对象的转换工作,与参数传递的方向无关。
3、当content-type为app
				
Date.prototype.Format = function(fmt) { //author: meizz var o = { "M+": this.getMonth() + 1, //月份 "d+": this.getDate(), //日 "h+": this.getHours(), //小时 "m+": this.getMinutes(), //分 "s+": this.getSeconds(), //秒 "q+": Math.floor(..
&lt;pre class="javascript" name="code"&gt;/**    * 此JS文件是格式JS中日期时间的工具类,其中包含了传入日期对象Date,格式成想要的格式,&lt;br&gt;    * 或者传入字符串格式的时间个,次字符串日期对应的格式可以转换为相应的日期对象,&lt;br&gt;    * 可以计算两个日期之间的差值    * y...