.. highlightlang:: us .. index:: DT_Format .. _dt_format: DT_Format ========= .. us.tag DT_Format NOTREADYENGLISH DT_FUNC :ref:`DT_Format` generates a formatted string representation of the *rmDate* values. .. function:: smRet = DT_Format(rmDate, ssFormat) .. us.return **Return Value** *smRet* .. us.params **Parameters** .. uparam:: rmDate *rmDate* is a real matrix. .. uparam:: ssFormat *ssFormat* is a scalar string. The formatting string is similar to the :ref:`printf` formatting string. Formatting codes, preceded by a percent (%) sign, are replaced by the corresponding date/time component. Other characters in the formatting string are copied unchanged to the returned string. The value and meaning of the formatting codes for :ref:`DT_Format` are listed below: .. list-table:: :header-rows: 1 * - Value - Meaning * - %a - Abbreviated weekday name * - %A - Full weekday name * - %b - Abbreviated month name * - %B - Full month name * - %c - Date and time representation appropriate for locale * - %d - Day of month as decimal number (01 to 31) * - %H - Hour in 24-hour format (00 to 23) * - %I - Hour in 12-hour format (01 to 12) * - %j - Day of year as decimal number (001 to 366) * - %m - Month as decimal number (01 to 12) * - %M - Minute as decimal number (00 to 59) * - %p - Current locale's A.M./P.M. indicator for 12-hour clock * - %S - Second as decimal number (00 to 59) * - %U - Week of year as decimal number, with Sunday as first day of week (00 to 51) * - %w - Weekday as decimal number (0 to 6; Sunday is 0) * - %W - Week of year as decimal number, with Monday as first day of week (00 to 51) * - %x - Date representation for current locale * - %X - Time representation for current locale * - %y - Year without century, as decimal number (00 to 99) * - %Y - Year with century, as decimal number * - %z, %Z - Time zone name or abbreviation; no characters if time zone is unknown * - %% - Percent sign .. us.comment **Comment** The format argument consists of one or more codes; as in printf, the formatting codes are preceded by a percent sign (%). Characters that do not begin with % are copied unchanged to strDest. The ``LC_TIME`` category of the current locale affects the output formatting. (For more information on ``LC_TIME``, see :ref:`DT_SetLocale`.) The formatting codes are listed below: As in the :ref:`printf` function, the # flag may prefix any formatting code. In that case, the meaning of the format code is changed as follows. %#a, %#A, %#b, %#B, %#p, %#X, %#z, %#Z, %#%: # flag is ignored. %#c: Long date and time representation, appropriate for current locale. For example: ``"Tuesday, March 14, 1995, 12:41:29"``. %#x: Long date representation, appropriate to current locale. For example: ``"Tuesday, March 14, 1995"``. %#d, %#H, %#I, %#j, %#m, %#M, %#S, %#U, %#w, %#W, %#y, %#Y: Remove leading zeros (if any). .. us.example **Example** :: * d = DT_GetCurrentTime() * d 35992.3731 * DT_Format(d, "%c") 16.07.98 08:57:14 * DT_Format(d, "%#c") Donnerstag, 16. Juli 1998 08:57:14 * DT_Format(d, "%x") 16.07.98 * DT_Format(d, "%X") 08:57:14 .. seealso:: :ref:`overview-date-and-time`, :ref:`DT_SetLocale`, :ref:`DT_ParseDateTime`, :ref:`DT_GetCurrentTime` :sub:`id-1118602`