UP | HOME

日期和时间

Table of Contents

1 日期

1.1 增加农历

sudo apt-get install lunar-applet
鼠标点击面板右键 -> 添加到面板 -> 农历日期  

1.2 设置日期

date -s mm/dd/yy

2 时间

2.1 设置时间

date -s HH:MM

2.2 将时间写入CMOS

hwclock --systohc

2.3 读取CMOS时间

hwclock --hctosys

2.4 从服务器上同步时间

sudo ntpdate ntp.ubuntu.com
sudo ntpdate time.nist.gov

2.5 设置电脑的时区为上海

sudo cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime

2.6 XP 和 Ubuntu 相差了 8 小时的时差

#关闭UTC,将当前时间写入CMOS。
sudo sed -ie 's/UTC=yes/UTC=no/g' /etc/default/rcS
sudo hwclock --systohc

Date: 2012-04-11 Wed

Author: Joseph Pan

Validate XHTML 1.0