JavaScript的Date对象有容错性,可将随意给定的日期的年月日自动生成正确的日期时间 //JavaScript中Date对象容错性 function dateCheck(){ var date = new Date(); date.setDate(date.getDate()+13); //date.setDate(date.getMonth()+1+10); //打印依然能输出正确的日期 console.log(date.getFullYear()+"年"+(date.get
linux中用shell获取昨天.明天或多天前的日期:在Linux中对man date -d 参数说的比较模糊,以下举例进一步说明:# -d, --date=STRING display time described by STRING, not `now’[root@Gman root]# date -d next-day +%Y%m%d #明天日期20091024[root@Gman root]# date -d last-day +%Y%m%d #昨天日期20091022[root@Gma
//判断给定字符串是否是回文 function isPalindrome(word) { var s = new Stack(); for (var i = 0; i < word.length; i++) { s.push(word[i]); } var rword = ""; while (s.length()>0) { rword +
var date = new Date(); alert(date);//获取当前时间 alert(date.getFullYear());//获取当前年分 alert(date.getMonth());//获取月份(获取当前月份要加1) alert(date.getDate());//获取当前日期的几号 alert(date.getDay());//获取当前是星期几 alert(date.getTime());//获取距离1970/01/01 至今的毫秒 settime()是向 1970/01
核心代码 #!/bin/sh myPath="/var/log/httpd/" myFile="/var /log/httpd/access.log" #这里的-x 参数判断$myPath是否存在并且是否具有可执行权限 if [ ! -x "$myPath"]; then mkdir "$myPath" fi #这里的-d 参数判断$myPath是否存在 if [ ! -d "$myPath"]; then