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おそらく、変数名とに基づいて違いをかなり推測できますが、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

明らかに、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

%x は、入力を 16 進数にフォーマットします。%x と %X の違いは、文字が大文字で書かれていることです。

例えば

%x、15 は f になります

%X、15 は F になります

于 2012-07-21T15:01:42.367 に答える