- clock format [ clock seconds ] -format "%Y%m%d%H%M%S" ]
- %Y - Year with century (e.g. 1990)
- %y - Year without century (00 - 99).
- %m - month
- %d - Day of month (01 - 31).
- %H - Hour in 24-hour format (00 - 23).
- %I - Hour in 12-hour format (00 - 12).
- %M - Minute (00 - 59).
- %S - Seconds (00 - 59).
[ExampleCode]
- set currentDate [ clock format [clock seconds] -format "%Y%m%d" ]
- set currentTime [ clock format [clock seconds] -format "%H%M%S" ]
- puts $currentDate
- puts $currentTime
[Output]
- 20140603 --> 2014 June 03
- 150006 --> 15:00:06
[Clock format others]
- %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.
- %p - AM/PM indicator.
- %w - Weekday number (Sunday = 0).
- %x - Locale specific date format.
- %X - Locale specific time format.
- %Z - Time zone name.
%Z - Time zone name
In addition, the following field descriptors may be supported on some systems (e.g. Unix but not Windows):
沒有留言:
張貼留言