linux设置系统时间和时区

1、设置系统时间

date命令将日期设置为2014年6月18日

----   date -s 06/18/14

将时间设置为14点20分50秒

----   date -s 14:20:50

将时间设置为2014年6月18日14点16分30秒(MMDDhhmmYYYY.ss)

----date 0618141614.30

2、设置系统时区:

tzselect

[[email protected] trunk]# tzselect
Please identify a location so that time zone rules can be set correctly.
Please select a continent, ocean, "coord", or "TZ".
1) Africa
2) Americas
3) Antarctica
4) Arctic Ocean
5) Asia
6) Atlantic Ocean
7) Australia
8) Europe
9) Indian Ocean
10) Pacific Ocean
11) coord - I want to use geographical coordinates.
12) TZ - I want to specify the time zone using the Posix TZ format.
#? 5
Please select a country whose clocks agree with yours.
1) Afghanistan 18) Israel 35) Palestine
2) Armenia 19) Japan 36) Philippines
3) Azerbaijan 20) Jordan 37) Qatar
4) Bahrain 21) Kazakhstan 38) Russia
5) Bangladesh 22) Korea (North) 39) Saudi Arabia
6) Bhutan 23) Korea (South) 40) Singapore
7) Brunei 24) Kuwait 41) Sri Lanka
8) Cambodia 25) Kyrgyzstan 42) Syria
9) China 26) Laos 43) Taiwan
10) Cyprus 27) Lebanon 44) Tajikistan
11) East Timor 28) Macau 45) Thailand
12) Georgia 29) Malaysia 46) Turkmenistan
13) Hong Kong 30) Mongolia 47) United Arab Emirates
14) India 31) Myanmar (Burma) 48) Uzbekistan
15) Indonesia 32) Nepal 49) Vietnam
16) Iran 33) Oman 50) Yemen
17) Iraq 34) Pakistan
#? 9
Please select one of the following time zone regions.
1) Beijing Time
2) Xinjiang Time

时间: 2024-08-27 14:31:42

linux设置系统时间和时区的相关文章

Linux 设置系统时间和日期 API

嵌入式Linux 设置时间和日期 API ,它是busybox要提取的源代码. Linux设置时间和日期的步骤: 1. 设置系统时间和日期: 2. 该系统的时间和日期,同步到硬件. #include <stdio.h> #include <fcntl.h> #include <sys/types.h> #include <sys/stat.h> #include <sys/ioctl.h> #include <time.h> #inc

linux设置系统时间

设置系统时间 -         date命令:显示系统的时间,能够在直接输入"date"命令来查看系统的时间 -           date+%y/%m/%d -           2005/06/23 -           date +%H:%M -           17:25 -         利用date命令来更改系统的时间 -           dateMMDDHHMMCCYY.SS:月月日日时时分分年年.秒秒 -         查看月历 -         

linux修改系统时间和时区

1.修改系统时间linux系统时钟有两个,一个是硬件时钟,即BIOS时间,就是我们进行CMOS设置时看到的时间,另一个是系统时钟,是linux系统Kernel时间.当Linux启动时,系统Kernel会去读取硬件时钟的设置,然后系统时钟就会独立于硬件运作.有时我们会发现系统时钟和硬件时钟不一致,因此需要执行时间同步,下面就分享一下时间设置及时钟同步的命令使用方法.date命令将日期设置为2014年6月18日 ---- date -s 06/18/14将时间设置为14点20分50秒 ---- da

linux设置系统时间与各种阻塞

前阵子做了一个P2P的通信系统,发现开机的时候和中间运行的时候会莫名报错,这个问题找了好久,后来从日志中看出来,所有节点上阻塞的操作同时超时. 而在超时左右,有新节点自动加入系统. 在新节点加入系统的时候,整个系统会做一次对时.后来把对时注释掉,一切正常. 我个人怀疑当用settimeofday设置系统时候的时候,所有与时间相关的操作都会“脏”,然后变得行为不可测(虽然从表面看是全超时). 在此记录,以做备忘.

修改linux的系统时间和时区

时间: date命令将日期设置为2016年12月16日 ----   date -s 12/16/16 将时间设置为9点28分50秒 ----   date -s 09:28:50 时区: tzselect: 执行tzselect命令-->选择Asia-->选择China-->选择east China - Beijing, Guangdong, Shanghai, etc-->然后输入1 TZ='Asia/Shanghai';

linux系统修改系统时间与时区

(1)修改系统时间. linux系统时钟有两个,一个是硬件时钟,即BIOS时间,就是我们进行CMOS设置时看到的时间,另一个是系统时钟,是linux系统Kernel时间.当Linux启动时,系统Kernel会去读取硬件时钟的设置,然后系统时钟就会独立于硬件运作.有时我们会发现系统时钟和硬件时钟不一致,因此需要执行时间同步,下面就分享一下时间设置及时钟同步的命令使用方法. date命令将日期设置为2014年6月18日 ----   date -s 06/18/14 将时间设置为14点20分50秒

自动调整linux系统时间和时区与Internet时间同步

调整linux系统时间和时区与Internet时间同步 一.修改时区:# cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime修改为中国的东八区# vi /etc/sysconfig/clockZONE="Asia/Shanghai"UTC=falseARC=false 二.配置新的时间日期设定:# date -s 2008/05/06 时间设定:# date -s 18:40:00 查看硬件时间(BIOS的):    hwclock

Qt linux下设置系统时间

想要能修改 ARM板上的系统时间,试了两种方法: 1.采用系统命令.system() 尝试了很多命令,date -s "20090807 16:02:23" :date -s 16:02:23 :但板子上的日期就是设置不成功,采用date -s 16:02:23 可以将时间设置成功.于是不得不考虑别的方法. 2.标准C库 首先感叹下,C库很强大呀! 而且我觉着C库的移植行很好.相比较采用system()命令,可能由于linux 版本的不同,好多命令可能存在差异,比如redhat 和ub

QT在linux环境下读取和设置系统时间(通过system来直接调用Linux命令,注意权限问题)

QT在Linux环境下读取和设置系统时间 本文博客链接:http://blog.csdn.NET/jdh99,作者:jdh,转载请注明. 环境: 主机:Fedora12 开发软件:QT 读取系统时间 [cpp] view plain copy void moreidDialog::refresh_time() { QDateTime time; txt_time->setText(time.currentDateTime().toString("yyyy") + ".&