首页 > 代码库 > localStorage

localStorage

将数组转换成json后,存入localStorage

https://my.oschina.net/crazymus/blog/371757

http://blog.csdn.net/u011413061/article/details/49999785 

时间函数:

function compareTime(myTime) {
        var currentTime = new Date;
        var myArray = Array();
        myArray[0] = currentTime.getFullYear();
        myArray[1] = currentTime.getMonth();
        myArray[2] = currentTime.getDate();
        myArray[3] = currentTime.getHours();
        myArray[4] = currentTime.getMinutes();
        myArray[5] = currentTime.getSeconds();
        for (var i in myArray){
            console.log("myArray"+[i]+": "+myArray[i]);
        }
        for (var x=0; x<4 ; x++){
            if (myArray[x]);
        }
     }

  

localStorage