日期时间
来源:互联网 发布:python 缺省 编辑:程序博客网 时间:2024/04/29 12:05
1. date
1) 显示时间
date +%sdate --date="2 days ago" +%Y%m%ddate -d "2013-11-19 16:24:20" +%s date -d "@1384849460"date -d "@1384849460" +"%Y-%m-%d %H:%M:%S"date -d "@1384849460" +"%F %H:%M:%S"date -d "1970-01-01 utc 1384849460 seconds"echo "1384849460" | awk '{print strftime("%F %T",$0)}'perl -e 'print localtime(1384849460)."\n"'
2) 修改系统时间
date -s 12/30/2008date -s 15:36:00date -s "2012-12-09 14:53:00"hwclock --systohc
2. timezone 时区设置
1). timzone文件
ls -F /usr/share/zoneinfo/
2). timzone文件时区详情
zdump Hongkong
3). 设置时区的两种方法。
a. 直接使用timezone文件
ln -s /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
b. 设置环境变量TZ,其优先级高于timezone文件
tzselectvi /etc/profile
3. 硬件时钟
1) 硬件时钟和系统时钟
Real Time Clock (RTC): 硬件时钟,主板上BIOS中的时间,由主板电池供电来维持运行,系统开机时读取这个时间,并用它来设定系统时间
System Time Clock: 系统时钟,kernel
2) /etc/sysconfig/clock
a. 只对hwclock有效,只在系统启动和关闭时有用
b. UTC=false,date、hwclock、hwclcok –localtime 输出时间一致,此时hwclock –utc无效
c. UTC=ture,date、hwclock 输出一致,hwclock –localtime 输出是UTC时间
3) 时钟同步
hwclock --show# BIOS to kernelhwclock --hctosys# kernel to BIOShwclock --systohc
4. 夏令时:
vi /etc/profileexport TZ=BEIST-8BEIDT-9,M6.2.4/14:20,M6.2.4/17:00 # M6.2.4: 6月的第2个星期四
NTP-Server
1. vi /etc/ntp.conf#broadcastclient server 127.127.1.02. restartrcntp restart3. check # watch ntpq -pntpq -p4. automatic startchkconfig -a ntp
NTP-Client:
1. time synchronization
crontab -e0,30 * * * * /usr/sbin/ntpdate -u ntp.server.com
0 0
- 时间日期
- 日期时间
- 日期时间
- 时间/日期
- 日期时间
- 日期 时间
- 时间日期
- 时间日期
- 日期时间
- 时间日期
- 时间日期
- aos 时间 日期 时间
- C#-日期时间-时间日期操作
- 日期时间去掉日期后面的时间
- 时间戳转时间、日期
- 时间日期格式-国家标准
- 时间日期格式-ISO8601
- 时间日期格式-W3C
- 神经网络之BP神经网络
- 搭建高质量的Android项目框架系列二
- Baymax (Android版的Siri)之百度语音识别SDK调用
- 玩转Podfile
- bzoj 2946/Spoj 8222 后缀自动机
- 日期时间
- HDU 1232 畅通工程 (并查集)
- DEPENDENT SUBQUERY标记
- objectc -c 之 property 与synthesize小记 (2)
- 【并查集】破译密文
- 三、插入排序
- 文章标题
- cc.ScrollView的坑
- 欢迎使用CSDN-markdown编辑器