1.日期和字符转换函数用法(to_date,to_char)select to_char(sysdate,'yyyy-mm-dd hh24:mi:ss') as nowTime from dual; //日期转化为字符串 select to_char(sysdate,'yyyy') as nowYear from dual; //获取时间的年 select to_char(sysdate,'mm') as nowMonth from dual; //获取时间的月 select to_char(s…
shell中的时间日期获取 cat test5: #!/bin/bash # using the backtick character testing=`date` echo "The date and time are:" $testing date=`date +%Y-%m-%d_%H-%M-%S` echo "The date are:" $date 添加可执行权限:chmod u+x test5 运行:./test5 结果如下: The :: CST The…
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…