码迷,mamicode.com
首页 > 其他好文 > 详细

time

时间:2014-05-09 05:52:01      阅读:247      评论:0      收藏:0      [点我收藏+]

标签:style   blog   class   code   java   ext   

public ActionResult GetAllList()         {

            var list = db.Movies.ToList();

            return Json(list, JsonRequestBehavior.AllowGet);             //return Content(a);

        }

 

bubuko.com,布布扣
@section Scripts{
    <script type="text/javascript">
        function formatNumToDate(value) {
          var now = eval(value.replace(/\/Date\((\d+)\)\//gi, "new Date($1)"));///.../gi是用来标记正则开始和结束;\是转义符;()标注了正则匹配分组1,$1
          var year = now.getYear() + 1900;
          var month = now.getMonth() + 1;
          var date = now.getDate();
          var hour = now.getHours();
           var minute = now.getMinutes();
           var second = now.getSeconds();
           return year + "-" + compareNine(month) + "-" + compareNine(date) + " " + compareNine(hour) + ":" + compareNine(minute) + ":" + compareNine(second);
       }

        $(document).ready(function () {
            function ChangeDateFormat(time) {
                if (time != null) {
                    var date = new Date(parseInt(time.replace("/Date(", "").replace(")/", ""), 10));
                    var month = date.getMonth() + 1 < 10 ? "0" + (date.getMonth() + 1) : date.getMonth() + 1;
                    var currentDate = date.getDate() < 10 ? "0" + date.getDate() : date.getDate();
                    return date.getFullYear() + "-" + month + "-" + currentDate;
                }
                return "";
            }
            $("#TestList").click(function () {

                $.getJSON("/Movies/GetAllList", {}, function (result) {
                    
                    alert(result);
                    $.each(result, function (i, field) {
                        //var datetime = field.ReleaseDate.formatNumToDate();
                        
                        alert(i + " " + ChangeDateFormat(field.ReleaseDate));

                    });







                });
            });


        });
     </script>
    }
bubuko.com,布布扣

 

time,布布扣,bubuko.com

time

标签:style   blog   class   code   java   ext   

原文地址:http://www.cnblogs.com/MarchThree/p/3717987.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!