TCL 取时间、格式化时间

本文介绍了如何在TCL中使用`clock seconds`获取整型时间戳以及使用`clock format`命令进行时间格式化,包括各种格式化选项如%a、%A、%m、%d等。通过示例展示了如何将时间戳转化为易读的日期和时间格式,并讨论了如何提取日期部分作为变量使用。
摘要由CSDN通过智能技术生成

clock seconds 取一个整型值

用命令可以格式化时间

 

clock format  时间变量 -format 参数

参数可以为:

%% Insert a %.
%a Abbreviated weekday name (Mon, Tue, etc.).
%A Full weekday name (Monday, Tuesday, etc.).
%b Abbreviated month name (Jan, Feb, etc.).
%B Full month name.
%c Locale specific date and time.
%d Day of month (01 – 31).
%H Hour in 24-hour format (00 – 23).
%I Hour in 12-hour format (00 – 12).
%j Day of year (001 – 366).
%m Month number (01 – 12).
%M Minute (00 – 59).
%p AM/PM indicator.
%S Seconds (00 – 59).
%U Week of year (01 – 52), Sunday is the first day of the week.
%w Weekday number (Sunday = 0).
%W Week of year (01 – 52), Monday is the first day of the week.
%x Locale specific date format.
%X Locale specific time format.
%y Year without century (00 – 99).
%Y Year with century (e.g. 1990)

%D Date as %m/%d/%y.

  • 2
    点赞
  • 28
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值