当前位置:网站首页>date command
date command
2022-08-01 01:10:00 【HUAWEI CLOUD】
时间相关的指令
date显示
语法:date 选项 格式
功能:用于显示时间,设置时间,完成时间与时间戳之间的相互转换等
用途
1.在显示方面,使用者可以设定欲显示的格式,格式设定为一个加号,后接数个标记,其中常用的标记列表如下
%H : 小时(00~23)
%M : 分钟(00…59)
%S : 秒(00…61)
%X : 相当于 %H:%M:%S
%d : 日 (01…31)
%m : 月份 (01…12)
%Y : 完整年份 (0000…9999)
%F : 相当于 %Y-%m-%d
用途2.在设定时间方面
date -s :设置当前时间,只有root权限才能设置,Other ordinary users can only view.
date -s 20080523 //set the date to20080523,这样会把具体时间设置成空00:00:00
date -s 01:01:01 //设置具体时间,不会对日期做更改
date -s “01:01:01 2008-05-23″ //This allows you to set the date and time at the same time
date -s “01:01:01 20080523″ //This allows you to set the date and time at the same time
date -s “2008-05-23 01:01:01″ //This allows you to set the date and time at the same time
date -s “20080523 01:01:01″ //This allows you to set the date and time at the same time
用途3.时间戳 完成时间与时间戳之间的相互转换
什么是时间戳: 当前时间和计算机起始时间(1970年1月1日)的差值,单位为秒
Unix时间戳(英文为Unix epoch, Unix time, POSIX time 或 Unix timestamp)是从1970年1月1日(UTC/GMT的午夜)开始所经过的秒数,不考虑闰秒.
1)时间->时间戳:date +%s
时间戳: 1970/01/01/00:00累计到现在的秒数,给程序看的
2)时间戳->时间:date [email protected]
边栏推荐
- Force buckle 2326, 197
- leetcode:1562. 查找大小为 M 的最新分组【模拟 + 端点记录 + 范围合并】
- 2022年最新重庆建筑八大员(电气施工员)模拟题库及答案
- Kyoto University: Masaki Waga | Dynamic Masking for Reinforcement Learning in Black Box Environments
- MYSQL查询截取优化分析
- qlib量化源码分析:qlib/qlib/contrib/model/gbdt.py
- SC7A20(士兰微-加速度传感器)示例
- Rasa 3.x 学习系列-使用查找表改进实体提取
- ROS2系列知识(4): 理解【服务】的概念
- [Microservice] Distributed Transaction Solution - Seata
猜你喜欢
In 2022, the latest eight Chongqing construction members (electrical construction workers) simulation question bank and answers
力扣二叉树
Kyoto University:Masaki Waga | 黑箱环境中强化学习的动态屏蔽
南方科技大学:Xiaoying Tang | AADG:视网膜图像分割领域泛化的自动增强
微信小程序之小程序页面语法
现代企业架构框架1
Likou Binary Tree
TCP协议详解
Classes and Objects: Above
Introduction to the five data types of Redis
随机推荐
MYSQL关键字Explain解析
OSD read SAP CRM One Order application log way of optimization
继承和友元,静态成员的关系
MYSQL经典面试题
蓝图:杨辉三角排列
Qlib quantitative source analysis: qlib/qlib/contrib/model/GBDT py
Luogu P3373: Segment tree
从零造键盘的键盘超级喜欢,IT人最爱
You need to know the TCP wave four times
微信小程序之小程序页面语法
【密码学/密码分析】基于TMTO的密码分析方法
机器学习应该如何入门?
考研备考方案
Introduction to the decision logic of WAASAP WebClient UI page labels
精心总结十三条建议,帮你创建更合适的MySQL索引
Matlab / Arcgis处理nc数据
MYSQL二阶段提交
July Bootcamp (Day 31) - Status Compression
现代企业架构框架1
MVCC总结