最近偶为了写一个调整时间的shell而绞尽脑汁,结果在某一天#info data这里面看到了data -d参数的灵活用法,真是欣喜若狂.好东西要保存,整理整理: * To print the date of the day before yesterday: date --date='2 days ago' * To print the date of the day three months and one day hence: date --date='3 months 1 day' * T…
1.获取服务器时间: var now = new Date($.ajax({async: false}).getResponseHeader("Date")); 2.new Date()用法(获取客户端时间): 获取年: var currentYear = now.getFullYear(); 获取月: var currentMonth = now.getMonth(); 获取日: var currentDay = now.getDate(); 获取小时: var currentHou…
Date 对象用于处理日期和时间.创建 Date 对象的语法: 代码如下 复制代码 var myDate=new Date() Date 对象会自动把当前日期和时间保存为其初始值.参数形式有以下5种: 代码如下 复制代码 new Date("month dd,yyyy hh:mm:ss");new Date("month dd,yyyy");new Date(yyyy,mth,dd,hh,mm,ss);new Date(yyyy,mth,dd);new Date…
date命令的用法: [root@apache ~]# date //查看当前系统的时间 Sat Jun 14 13:46:02 CST 2014 [root@apache ~]# date -s "2015-06-07 12:30" //修改当前系统的时间 Sun Jun 7 12:30:00 CST 2015 [root@apache ~]# date +%T //显示当前系统的时间,时分秒24制 13:47:13 [root@apache ~]# date +%X //一样的显…