SmartTime是一个JQuery时间格式化插件,方便把时间格式化。

<!DOCTYPE html>
<html>
<head>
    <title>SmartTime</title>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body>
<div class="smartTime" smartTime="1413700725">2014/10/19 14:38:45</div>
<div class="smartTime" smartTime="1413700525">2014/10/19 14:38:45</div>
<div class="smartTime" smartTime="1413700425">2014/10/19 14:38:45</div>
<div class="smartTime" smartTime="1413700225">2014/10/19 14:38:45</div>
<div class="smartTime" smartTime="1413699125">2014/10/19 14:38:45</div>
<div class="smartTime" smartTime="1413619125">2014/10/19 14:38:45</div>
<div class="smartTime" smartTime="1413599125">2014/10/19 14:38:45</div>
<div class="smartTime" smartTime="1413199125">2014/10/19 14:38:45</div>
<div class="smartTime" smartTime="1412699125">2014/10/19 14:38:45</div>
<script src="jquery-1.11.1.min.js"></script>
<script src="SmartTime.js"></script>
<script type="text/javascript">
    $(function(){
        $(".smartTime").smartTime({
            to: "yyyy-MM-dd",
            attr: "smartTime"
        });
    });
</script>
</body>
</html>