0

“%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').")
4

4 回答 4

1

显然,如果您看到 insert-time-format 的描述,您将看到:

%x 是区域设置的“首选”日期格式。

%X 是区域设置的“首选”时间格式。

于 2012-07-21T15:10:31.893 回答
1
%x inserts the time.
%X inserts the date.
于 2012-07-21T15:12:14.733 回答
1

您可能会根据变量名称insert-time-format和对差异做出很好的猜测insert-date-format,但是之后您的第一个调用端口应该是format-time-string对这两个变量的帮助中提到的函数的帮助:

C-hf format-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".
于 2012-07-21T16:04:06.987 回答
-1

%x 将输入格式化为十六进制。%x 和 %X 的区别在于字母是大写的。

例如

%x, 15 将是 f

%X, 15 将是 F

于 2012-07-21T15:01:42.367 回答