以下功能中「%X」和「%x」之間的區別是什麼?格式化時間字符串中%X和%x有什麼區別?
(defvar insert-time-format "%X"
"*Format for \\[insert-time] (c.f. 'format-time-string').")
-----------
(defvar insert-date-format "%x"
"*Format for \\[insert-date] (c.f. 'format-time-string').")
以下功能中「%X」和「%x」之間的區別是什麼?格式化時間字符串中%X和%x有什麼區別?
(defvar insert-time-format "%X"
"*Format for \\[insert-time] (c.f. 'format-time-string').")
-----------
(defvar insert-date-format "%x"
"*Format for \\[insert-date] (c.f. 'format-time-string').")
明顯,如果你看到的插入時間格式的描述,你會看到:
%x是語言環境的「首選」日期格式。
%X是語言環境的「首選」時間格式。
%x將輸入格式化爲十六進制。 %x和%X的區別在於這些字母是用大寫字母寫的。
E.g.
%×,15爲f
%X,15會爲F
他談到其他格式,而不是(格式...) – alinsoar 2012-07-21 15:11:08
%x inserts the time.
%X inserts the date.
你也許需要一個很好的猜測基礎上的變量名insert-time-format
和insert-date-format
不同,但是之後,你的第一個停靠港應該是它在幫助中提到的format-time-string
功能的幫助兩種這些變量:
章˚Fformat-time-string
RET
format-time-string is a built-in function in `C source code'.
(format-time-string FORMAT-STRING &optional TIME UNIVERSAL)
Use FORMAT-STRING to format the time TIME, or now if omitted.
TIME is specified as (HIGH LOW . IGNORED), as returned by
`current-time' or `file-attributes'. The obsolete form (HIGH . LOW)
is also still accepted.
The third, optional, argument UNIVERSAL, if non-nil, means describe TIME
as Universal Time; nil means describe TIME in the local time zone.
The value is a copy of FORMAT-STRING, but with certain constructs replaced
by text that describes the specified date and time in TIME:
%Y is the year, %y within the century, %C the century.
%G is the year corresponding to the ISO week, %g within the century.
%m is the numeric month.
%b and %h are the locale's abbreviated month name, %B the full name.
%d is the day of the month, zero-padded, %e is blank-padded.
%u is the numeric day of week from 1 (Monday) to 7, %w from 0 (Sunday) to 6.
%a is the locale's abbreviated name of the day of week, %A the full name.
%U is the week number starting on Sunday, %W starting on Monday,
%V according to ISO 8601.
%j is the day of the year.
%H is the hour on a 24-hour clock, %I is on a 12-hour clock, %k is like %H
only blank-padded, %l is like %I blank-padded.
%p is the locale's equivalent of either AM or PM.
%M is the minute.
%S is the second.
%N is the nanosecond, %6N the microsecond, %3N the millisecond, etc.
%Z is the time zone name, %z is the numeric form.
%s is the number of seconds since 1970-01-01 00:00:00 +0000.
%c is the locale's date and time format.
%x is the locale's "preferred" date format.
%D is like "%m/%d/%y".
%R is like "%H:%M", %T is like "%H:%M:%S", %r is like "%I:%M:%S %p".
%X is the locale's "preferred" time format.
Finally, %n is a newline, %t is a tab, %% is a literal %.
Certain flags and modifiers are available with some format controls.
The flags are `_', `-', `^' and `#'. For certain characters X,
%_X is like %X, but padded with blanks; %-X is like %X,
but without padding. %^X is like %X, but with all textual
characters up-cased; %#X is like %X, but with letter-case of
all textual characters reversed.
%NX (where N stands for an integer) is like %X,
but takes up at least N (a number) positions.
The modifiers are `E' and `O'. For certain characters X,
%EX is a locale's alternative version of %X;
%OX is like %X, but uses the locale's number symbols.
For example, to produce full ISO 8601 format, use "%Y-%m-%dT%T%z".
乾杯好友... – Daniel 2012-07-21 19:32:57
哦,是的!你對,thx – Daniel 2012-07-21 15:11:52