js日付変換sttoDate
1087 ワード
//
var myStartStr = “2015-05-04 17:10:10”
var myEndStr = “2015-05-04 17:10:10”
var myStartDate = new Date(Date.parse(myStartStr.replace(/-/g, "/")));
var myEndDate = new Date(Date.parse(myEndStr.replace(/-/g, "/")));
//js
var currDate = new Date();
if(currDatemyEndDate){
alert(" ");
return;
}
// :
myStrDate.getYear(); // (2 )
myStrDate.getFullYear(); // (4 ,1970-????)
myStrDate.getMonth(); // (0-11,0 1 )
myStrDate.getDate(); // (1-31)
myStrDate.getDay(); // X(0-6,0 )
myStrDate.getTime(); // ( 1970.1.1 )
myStrDate.getHours(); // (0-23)
myStrDate.getMinutes(); // (0-59)
myStrDate.getSeconds(); // (0-59)
myStrDate.getMilliseconds(); // (0-999)
myStrDate.toLocaleDateString(); // 2015/5/4
var mytime=myStrDate .toLocaleTimeString(); // 5:10:47
myStrDate .toLocaleString( ); // 2015/5/4 5:10:47