---
name: "tm"
section: "3"
platform: "macos"
package: "ksh"
version: "42"
release: "macOS 26.5"
platforms: ["macos"]
url: "https://new.carta.tech/tm/3"
---

# tm(3)

seconds resolution time conversion support

## NAME

tm - seconds resolution time conversion support

## SYNOPSIS

$1$2#include \<tm.h\>#include \<tm.h\>#include \<tm.h\>#include \<tm.h\>#include \<tm.h\>#include \<tm.h\>#include \<tm.h\>#include \<tm.h\>

## DESCRIPTION

The *tm* library supports conversion between string date specifications, seconds reolution $1$2time\_ttime\_ttime\_ttime\_ttime\_ttime\_ttime\_ttime\_t clock values and $1$2Tm\_tTm\_tTm\_tTm\_tTm\_tTm\_tTm\_tTm\_t $1$2Tm\_tTm\_tTm\_tTm\_tTm\_tTm\_tTm\_tTm\_t contains the elements of $1$2struct tmstruct tmstruct tmstruct tmstruct tmstruct tmstruct tmstruct tm along with these additions:

- $1$2unsigned \_ast\_int4\_t tm\_nsecunsigned \_ast\_int4\_t tm\_nsecunsigned \_ast\_int4\_t tm\_nsecunsigned \_ast\_int4\_t tm\_nsecunsigned \_ast\_int4\_t tm\_nsecunsigned \_ast\_int4\_t tm\_nsecunsigned \_ast\_int4\_t tm\_nsecunsigned \_ast\_int4\_t tm\_nsec

  The subsecond portion of the time in nanoseconds.

- $1$2Tm\_zone\_t\* tm\_zoneTm\_zone\_t\* tm\_zoneTm\_zone\_t\* tm\_zoneTm\_zone\_t\* tm\_zoneTm\_zone\_t\* tm\_zoneTm\_zone\_t\* tm\_zoneTm\_zone\_t\* tm\_zoneTm\_zone\_t\* tm\_zone

  The time zone name.

$1$2localtime()localtime()localtime()localtime()localtime()localtime()localtime()localtime() and $1$2gmtime()gmtime()gmtime()gmtime()gmtime()gmtime()gmtime()gmtime() (see [**ctime**(3)](/ctime/3.md)) are used to determine local time zone and savings time information.

$1$2time\_ttime\_ttime\_ttime\_ttime\_ttime\_ttime\_ttime\_t values are the number of seconds since the epoch, **Jan 1 00:00:00 GMT 1970**, with leap seconds omitted.

The global variable $1$2int tm\_info.flagsint tm\_info.flagsint tm\_info.flagsint tm\_info.flagsint tm\_info.flagsint tm\_info.flagsint tm\_info.flagsint tm\_info.flags contains flags that allow all programs using the library to be controlled in a consistent manner. $1$2tm\_info.flagstm\_info.flagstm\_info.flagstm\_info.flagstm\_info.flagstm\_info.flagstm\_info.flagstm\_info.flags is initialized by the $1$2tminit()tminit()tminit()tminit()tminit()tminit()tminit()tminit() routine described below, and may be explicitly reset after $1$2tminit()tminit()tminit()tminit()tminit()tminit()tminit()tminit() is called. The flags are:

- $1$2TM\_ADJUSTTM\_ADJUSTTM\_ADJUSTTM\_ADJUSTTM\_ADJUSTTM\_ADJUSTTM\_ADJUSTTM\_ADJUST

  Set by $1$2tminit()tminit()tminit()tminit()tminit()tminit()tminit()tminit() if $1$2localtime()localtime()localtime()localtime()localtime()localtime()localtime()localtime() and $1$2gmtime()gmtime()gmtime()gmtime()gmtime()gmtime()gmtime()gmtime() do not compensate for leap seconds.

- $1$2TM\_LEAPTM\_LEAPTM\_LEAPTM\_LEAPTM\_LEAPTM\_LEAPTM\_LEAPTM\_LEAP

  $1$2time\_ttime\_ttime\_ttime\_ttime\_ttime\_ttime\_ttime\_t values are interpreted as if they include leap seconds. Set by $1$2tminit()tminit()tminit()tminit()tminit()tminit()tminit()tminit() if the $1$2leapleapleapleapleapleapleapleap option is set in the $1$2TM\_OPTIONSTM\_OPTIONSTM\_OPTIONSTM\_OPTIONSTM\_OPTIONSTM\_OPTIONSTM\_OPTIONSTM\_OPTIONS environment variable.

- $1$2TM\_UTCTM\_UTCTM\_UTCTM\_UTCTM\_UTCTM\_UTCTM\_UTCTM\_UTC

  Times are relative to **UTC** (universal coordinated time, i.e., **GMT**.) Otherwise times are relative to the local time zone. Set by $1$2tminit()tminit()tminit()tminit()tminit()tminit()tminit()tminit() if the time zone name matches one of $1$2tm\_info.format\[43\]tm\_info.format\[43\]tm\_info.format\[43\]tm\_info.format\[43\]tm\_info.format\[43\]tm\_info.format\[43\]tm\_info.format\[43\]tm\_info.format\[43\] through $1$2tm\_info.format\[46\]tm\_info.format\[46\]tm\_info.format\[46\]tm\_info.format\[46\]tm\_info.format\[46\]tm\_info.format\[46\]tm\_info.format\[46\]tm\_info.format\[46\] described below. If the time zone name is not determined by $1$2localtime()localtime()localtime()localtime()localtime()localtime()localtime()localtime() then the environment variables $1$2TZNAMETZNAMETZNAMETZNAMETZNAMETZNAMETZNAMETZNAME (as described in BSD 4.3) and $1$2TZTZTZTZTZTZTZTZ (as described in System V) are checked, in order. If this fails then the time zone name is constructed using the local time zone offset.

The routines are:

- $1$2time\_t tmdate(const char\* date, char\*\* end, time\_t\* clock)time\_t tmdate(const char\* date, char\*\* end, time\_t\* clock)time\_t tmdate(const char\* date, char\*\* end, time\_t\* clock)time\_t tmdate(const char\* date, char\*\* end, time\_t\* clock)time\_t tmdate(const char\* date, char\*\* end, time\_t\* clock)time\_t tmdate(const char\* date, char\*\* end, time\_t\* clock)time\_t tmdate(const char\* date, char\*\* end, time\_t\* clock)time\_t tmdate(const char\* date, char\*\* end, time\_t\* clock)

  Parses the date specification $1$2datedatedatedatedatedatedatedate using the $1$2tm\_info.formattm\_info.formattm\_info.formattm\_info.formattm\_info.formattm\_info.formattm\_info.formattm\_info.format string table (described below) and returns the equivalent $1$2time\_ttime\_ttime\_ttime\_ttime\_ttime\_ttime\_ttime\_t value. If $1$2non-non-non-non-non-non-non-non- $1$2endendendendendendendend is set to the position of the first unrecognized character in $1$2datedatedatedatedatedatedatedate $1$2clockclockclockclockclockclockclockclock is used to provide default values for omitted components in $1$2datedatedatedatedatedatedatedate If $1$2clockclockclockclockclockclockclockclock is $1$2NULLNULLNULLNULLNULLNULLNULLNULL then the current time is used.

- $1$2Tm\_t\* tmfix(Tm\_t\* tp)Tm\_t\* tmfix(Tm\_t\* tp)Tm\_t\* tmfix(Tm\_t\* tp)Tm\_t\* tmfix(Tm\_t\* tp)Tm\_t\* tmfix(Tm\_t\* tp)Tm\_t\* tmfix(Tm\_t\* tp)Tm\_t\* tmfix(Tm\_t\* tp)Tm\_t\* tmfix(Tm\_t\* tp)

  Corrects any out of bounds fields in $1$2tptptptptptptptp and returns $1$2tptptptptptptptp as its value. The corrections start with $1$2tp-\>tm\_sectp-\>tm\_sectp-\>tm\_sectp-\>tm\_sectp-\>tm\_sectp-\>tm\_sectp-\>tm\_sectp-\>tm\_sec and propagate down to $1$2tp-\>tm\_yeartp-\>tm\_yeartp-\>tm\_yeartp-\>tm\_yeartp-\>tm\_yeartp-\>tm\_yeartp-\>tm\_yeartp-\>tm\_year For example, if $1$2tp-\>tm\_sectp-\>tm\_sectp-\>tm\_sectp-\>tm\_sectp-\>tm\_sectp-\>tm\_sectp-\>tm\_sectp-\>tm\_sec were 61 then it would change to 1 and $1$2tp-\>tm\_mintp-\>tm\_mintp-\>tm\_mintp-\>tm\_mintp-\>tm\_mintp-\>tm\_mintp-\>tm\_mintp-\>tm\_min would be incremented by 1, and so on. $1$2tp-\>tm\_isdsttp-\>tm\_isdsttp-\>tm\_isdsttp-\>tm\_isdsttp-\>tm\_isdsttp-\>tm\_isdsttp-\>tm\_isdsttp-\>tm\_isdst is not changed -- call $1$2tmtime()tmtime()tmtime()tmtime()tmtime()tmtime()tmtime()tmtime() to determine its proper value after the $1$2tmfix()tmfix()tmfix()tmfix()tmfix()tmfix()tmfix()tmfix() adjustments.

- $1$2char\* tmfmt(char\* buf, size\_t len, const char\* format, time\_t\* clock)char\* tmfmt(char\* buf, size\_t len, const char\* format, time\_t\* clock)char\* tmfmt(char\* buf, size\_t len, const char\* format, time\_t\* clock)char\* tmfmt(char\* buf, size\_t len, const char\* format, time\_t\* clock)char\* tmfmt(char\* buf, size\_t len, const char\* format, time\_t\* clock)char\* tmfmt(char\* buf, size\_t len, const char\* format, time\_t\* clock)char\* tmfmt(char\* buf, size\_t len, const char\* format, time\_t\* clock)char\* tmfmt(char\* buf, size\_t len, const char\* format, time\_t\* clock)

  Formats the date pointed to by $1$2clockclockclockclockclockclockclockclock into the buffer $1$2bufbufbufbufbufbufbufbuf with size $1$2lenlenlenlenlenlenlenlen bytes according to the format specification $1$2formatformatformatformatformatformatformatformat If $1$2formatformatformatformatformatformatformatformat is $1$2NULLNULLNULLNULLNULLNULLNULLNULL or empty then the string $1$2tm\_info.format\[40\]tm\_info.format\[40\]tm\_info.format\[40\]tm\_info.format\[40\]tm\_info.format\[40\]tm\_info.format\[40\]tm\_info.format\[40\]tm\_info.format\[40\] is used. If $1$2clockclockclockclockclockclockclockclock is $1$2NULLNULLNULLNULLNULLNULLNULLNULL then the current time is used. A pointer to the end of $1$2bufbufbufbufbufbufbufbuf (i.e., the terminating $1$2'\\0''\\0''\\0''\\0''\\0''\\0''\\0''\\0' is returned.

  $1$2formatformatformatformatformatformatformatformat is in [**printf**(3)](/printf/3.md) style, where %*field* names a fixed size field, zero padded if necessary, and *\\c* and *\\nnn* sequences are as in C. Invalid %*field* specifications and all other characters are copied without change. *field* may be preceded by **%-** to turn off padding or **%\_** to pad with space, otherwise numeric fields are padded with **0** and string fields are padded with space. *field* may also be preceded by **E** for alternate era representation or **O** for alternate digit representation (if supported by the current locale.) Finally, an integral *width* preceding *field* truncates the field to *width* characters. sequences are interpreted as in the C language. String field values are taken from the $1$2tm\_info.formattm\_info.formattm\_info.formattm\_info.formattm\_info.formattm\_info.formattm\_info.formattm\_info.format string table. The *fields* are:

  - **%**

    **%** character.

  - **a**

    Abbreviated weekday name.

  - **A**

    Full weekday name.

  - **b**

    Abbreviated month name.

  - **c**

    [**ctime**(3)](/ctime/3.md) style date without the trailing **newline**.

  - **C**

    [**date**(1)](/date/1.md) style date.

  - **d**

    Day of month number.

  - **D**

    Date as *mm*/*dd*/*yy*.

  - **e**

    Blank padded day of month number.

  - **E**

    Unpadded day of month number.

  - **f**

    Locale default override date format.

  - **F**

    Locale default date format $1$2((((((((

  - **h**

    Abbreviated month name.

  - **H**

    24-hour clock hour.

  - **i**

    International [**date**(1)](/date/1.md) date that includes the time zone type name $1$2((((((((

  - **I**

    12-hour clock hour.

  - **j**

    1-offset Julian date.

  - **J**

    0-offset Julian date.

  - **k**

    [**date**(1)](/date/1.md) style date $1$2((((((((

  - **K**

    Language neutral, all numeric, no embedded space date with larger to smaller time units from left to right, suitable for sorting: $1$2''''''''

  - **l**

    [**ls**(1)](/ls/1.md) **-l** date that lists recent dates with $1$2%g%g%g%g%g%g%g%g and distant dates with **%G**.

  - **m**

    Month number.

  - **M**

    Minutes.

  - **n**

    **newline** character.

  - **N**

    The time zone type or nation code.

  - **p**

    Meridian (e.g., **AM** or **PM**.)

  - **q**

    The nanosecond part of the time.

  - **%Q***\<delim\>recent\<delim\>distant\<delim\>*

    Recent dates are formatted with *recent* and distand dates are formatted with *distant*, where *\<delim\>* is any character not appearing in *recent* or *distant*.

  - **r**

    12-hour time as *hh*:*mm*:*ss* *meridian*.

  - **R**

    24-hour time as *hh*:*mm*.

  - **s**

    Seconds since the epoch. .*prec* preceding **s** appends *prec* nanosecond digits, **9** if *prec* is omitted.

  - **S**

    *seconds.subseconds* since the epoch.

  - **t**

    **tab** character.

  - **T**

    24-hour time as *hh*:*mm*:*ss*.

  - **u**

    Weeday number with 1 for Monday, 7 for Sunday.

  - **U**

    Week number with Sunday as the first day.

  - **V**

    ISO week number (i18n is *fun*.)

  - **w**

    Weekday number with 0 for Sunday, 6 for Saturday.

  - **W**

    Week number with Monday as the first day.

  - **x**

    Local date style, using $1$2tm\_info.format\[39\]tm\_info.format\[39\]tm\_info.format\[39\]tm\_info.format\[39\]tm\_info.format\[39\]tm\_info.format\[39\]tm\_info.format\[39\]tm\_info.format\[39\] that includes the month, day and year.

  - **X**

    Local time style, using $1$2tm\_info.format\[38\]tm\_info.format\[38\]tm\_info.format\[38\]tm\_info.format\[38\]tm\_info.format\[38\]tm\_info.format\[38\]tm\_info.format\[38\]tm\_info.format\[38\] that includes the hours and minutes.

  - **y**

    2-digit year (you'll be sorry.)

  - **Y**

    4-digit year.

  - **z**

    Time zone *SHHMM* west of GMT offset where *S* is **+** or **-**.

  - **Z**

    Time zone name.

  - \=\[=\]\]\[-+\]\]*flag*

    Set (default or +) or clear (-) *flag* in $1$2tm\_info.flagstm\_info.flagstm\_info.flagstm\_info.flagstm\_info.flagstm\_info.flagstm\_info.flagstm\_info.flags for the remainder of *format*, or for the remainder of the process if **==** is specified. *flag* may be:

    - **l**

      $1$2(TM\_LEAP)(TM\_LEAP)(TM\_LEAP)(TM\_LEAP)(TM\_LEAP)(TM\_LEAP)(TM\_LEAP)(TM\_LEAP) Enable leap second adjustments.

    - **s**

      $1$2(TM\_SUBSECOND)(TM\_SUBSECOND)(TM\_SUBSECOND)(TM\_SUBSECOND)(TM\_SUBSECOND)(TM\_SUBSECOND)(TM\_SUBSECOND)(TM\_SUBSECOND) Append nanosecond **.%N** to **%S**.

    - **u**

      $1$2(TM\_UTC)(TM\_UTC)(TM\_UTC)(TM\_UTC)(TM\_UTC)(TM\_UTC)(TM\_UTC)(TM\_UTC) UTC time zone.

  - **#**

    Equivalent to **%s**.

  - ?*alternate*

    Use *alternate* format is a default format override has not been specified. e.g., [**ls**(1)](/ls/1.md) uses **%?%l**. Export TM\_OPTIONS="format='*override*'" to override the default.

- $1$2void tminit(Tm\_zone\_t\* zone)void tminit(Tm\_zone\_t\* zone)void tminit(Tm\_zone\_t\* zone)void tminit(Tm\_zone\_t\* zone)void tminit(Tm\_zone\_t\* zone)void tminit(Tm\_zone\_t\* zone)void tminit(Tm\_zone\_t\* zone)void tminit(Tm\_zone\_t\* zone)

  Implicitly called by the other *tm* library routines to initialize global data, including the $1$2tm\_info.formattm\_info.formattm\_info.formattm\_info.formattm\_info.formattm\_info.formattm\_info.formattm\_info.format table and the $1$2tm\_info.flagstm\_info.flagstm\_info.flagstm\_info.flagstm\_info.flagstm\_info.flagstm\_info.flagstm\_info.flags global flags. Global data should only be modified after an explicit call to $1$2tminittminittminittminittminittminittminittminit If $1$2zone != 0zone != 0zone != 0zone != 0zone != 0zone != 0zone != 0zone != 0 then it specifies a time zone other that the local time zone.

- $1$2void tmset(Tm\_zone\_t\* zone);void tmset(Tm\_zone\_t\* zone);void tmset(Tm\_zone\_t\* zone);void tmset(Tm\_zone\_t\* zone);void tmset(Tm\_zone\_t\* zone);void tmset(Tm\_zone\_t\* zone);void tmset(Tm\_zone\_t\* zone);void tmset(Tm\_zone\_t\* zone);

  $1$2tmsettmsettmsettmsettmsettmsettmsettmset sets the reference timezoe to $1$2zonezonezonezonezonezonezonezone $1$2tm\_info.localtm\_info.localtm\_info.localtm\_info.localtm\_info.localtm\_info.localtm\_info.localtm\_info.local points to the local timezone and $1$2tm\_info.zonetm\_info.zonetm\_info.zonetm\_info.zonetm\_info.zonetm\_info.zonetm\_info.zonetm\_info.zone points to the current reference timezone.

- $1$2time\_t tmleap(time\_t\* clock)time\_t tmleap(time\_t\* clock)time\_t tmleap(time\_t\* clock)time\_t tmleap(time\_t\* clock)time\_t tmleap(time\_t\* clock)time\_t tmleap(time\_t\* clock)time\_t tmleap(time\_t\* clock)time\_t tmleap(time\_t\* clock)

  Returns a $1$2time\_ttime\_ttime\_ttime\_ttime\_ttime\_ttime\_ttime\_t value for the time pointed to by $1$2clockclockclockclockclockclockclockclock with leap seconds adjusted for external routines that do not handle leap seconds. If $1$2clockclockclockclockclockclockclockclock is $1$2NULLNULLNULLNULLNULLNULLNULLNULL then the current time is used. Adjustments are only done if the $1$2TM\_ADJUSTTM\_ADJUSTTM\_ADJUSTTM\_ADJUSTTM\_ADJUSTTM\_ADJUSTTM\_ADJUSTTM\_ADJUST flag is set in $1$2tm\_info.flagstm\_info.flagstm\_info.flagstm\_info.flagstm\_info.flagstm\_info.flagstm\_info.flagstm\_info.flags

- $1$2Tm\_t\* tmmake(time\_t\* clock)Tm\_t\* tmmake(time\_t\* clock)Tm\_t\* tmmake(time\_t\* clock)Tm\_t\* tmmake(time\_t\* clock)Tm\_t\* tmmake(time\_t\* clock)Tm\_t\* tmmake(time\_t\* clock)Tm\_t\* tmmake(time\_t\* clock)Tm\_t\* tmmake(time\_t\* clock)

  Returns a pointer to the $1$2Tm\_tTm\_tTm\_tTm\_tTm\_tTm\_tTm\_tTm\_t struct corresponding to the time pointed to by $1$2clockclockclockclockclockclockclockclock If $1$2clockclockclockclockclockclockclockclock is $1$2NULLNULLNULLNULLNULLNULLNULLNULL then the current time is used.

- $1$2time\_t tmtime(Tm\_t\* tp, int west)time\_t tmtime(Tm\_t\* tp, int west)time\_t tmtime(Tm\_t\* tp, int west)time\_t tmtime(Tm\_t\* tp, int west)time\_t tmtime(Tm\_t\* tp, int west)time\_t tmtime(Tm\_t\* tp, int west)time\_t tmtime(Tm\_t\* tp, int west)time\_t tmtime(Tm\_t\* tp, int west)

  Returns the $1$2time\_ttime\_ttime\_ttime\_ttime\_ttime\_ttime\_ttime\_t value corresponding to $1$2tptptptptptptptp If $1$2westwestwestwestwestwestwestwest is $1$2TM\_LOCALZONETM\_LOCALZONETM\_LOCALZONETM\_LOCALZONETM\_LOCALZONETM\_LOCALZONETM\_LOCALZONETM\_LOCALZONE then $1$2tmtmtmtmtmtmtmtm is relative to the local time zone, otherwise $1$2westwestwestwestwestwestwestwest is the number of minutes west of **UTC** with daylight savings time taken into account. $1$2tp-\>tm\_wdaytp-\>tm\_wdaytp-\>tm\_wdaytp-\>tm\_wdaytp-\>tm\_wdaytp-\>tm\_wdaytp-\>tm\_wdaytp-\>tm\_wday $1$2tp-\>tm\_ydaytp-\>tm\_ydaytp-\>tm\_ydaytp-\>tm\_ydaytp-\>tm\_ydaytp-\>tm\_ydaytp-\>tm\_ydaytp-\>tm\_yday and $1$2tp-\>tm\_isdsttp-\>tm\_isdsttp-\>tm\_isdsttp-\>tm\_isdsttp-\>tm\_isdsttp-\>tm\_isdsttp-\>tm\_isdsttp-\>tm\_isdst are ignored in the conversion.

The library routines use a table of date strings pointed to by $1$2char\*\* tm\_info.formatchar\*\* tm\_info.formatchar\*\* tm\_info.formatchar\*\* tm\_info.formatchar\*\* tm\_info.formatchar\*\* tm\_info.formatchar\*\* tm\_info.formatchar\*\* tm\_info.format The indices in $1$2tm\_info.formattm\_info.formattm\_info.formattm\_info.formattm\_info.formattm\_info.formattm\_info.formattm\_info.format are fixed by category. $1$2tm\_info.formattm\_info.formattm\_info.formattm\_info.formattm\_info.formattm\_info.formattm\_info.formattm\_info.format may be changed to point to other tables according to local language and date conventions. The contents by index (showing the USA English values) are:

- **0-11**

  3-character abbreviated month names.

- **12-23**

  Full month names.

- **24-30**

  3-character abbreviated weekday names.

- **31-37**

  Full weekday names.

- **38**

  $1$2tmfmt()tmfmt()tmfmt()tmfmt()tmfmt()tmfmt()tmfmt()tmfmt() local time format used by the **%X** field.

- **39**

  $1$2tmfmt()tmfmt()tmfmt()tmfmt()tmfmt()tmfmt()tmfmt()tmfmt() local date format used by the **%x** field.

- **40**

  $1$2tmfmt()tmfmt()tmfmt()tmfmt()tmfmt()tmfmt()tmfmt()tmfmt() format used if the $1$2formatformatformatformatformatformatformatformat argument is $1$2NULLNULLNULLNULLNULLNULLNULLNULL or empty.

- **41-42**

  Meridian names: AM, PM.

- **43-46**

  **UTC** time zone names: GMT, UTC, UCT, CUT.

- **47-50**

  Daylight savings time suffix names: DST.

- **51-54**

  Suffixes to be ignored when matching strings in $1$2tmfmt()tmfmt()tmfmt()tmfmt()tmfmt()tmfmt()tmfmt()tmfmt()

- **55-61**

  Time part names: second, hour, minute, day, week, month, year.

- **62-65**

  Hours of the day names: midnight, morning, noon, evening.

- **66-68**

  Relative day names: yesterday, today, tomorrow.

- **69-71**

  Past relative time references: last, ago, past.

- **72-75**

  Current relative time references: this, now, current.

- **75-77**

  Future relative time references: next, hence, coming.

- **78-80**

  Exact relative time references: exactly.

- **81-84**

  Noise words to be ignored: at, in, on.

- **85-94**

  Ordinal suffixes: st, nd, rd, th, th, th, th, th, th, th.

- **95-104**

  Digit names.

- **105**

  The $1$2tmfmt()tmfmt()tmfmt()tmfmt()tmfmt()tmfmt()tmfmt()tmfmt() format equivalent for [**ctime**(3)](/ctime/3.md): $1$2''''''''

- **106**

  The $1$2tmfmt()tmfmt()tmfmt()tmfmt()tmfmt()tmfmt()tmfmt()tmfmt() [**date**(1)](/date/1.md) default format: $1$2''''''''

- **107**

  The $1$2tmfmt()tmfmt()tmfmt()tmfmt()tmfmt()tmfmt()tmfmt()tmfmt() [**date**(1)](/date/1.md) international format: $1$2''''''''

- **108**

  The $1$2tmfmt()tmfmt()tmfmt()tmfmt()tmfmt()tmfmt()tmfmt()tmfmt() [**ls**(1)](/ls/1.md) recent date format: $1$2''''''''

- **109**

  The $1$2tmfmt()tmfmt()tmfmt()tmfmt()tmfmt()tmfmt()tmfmt()tmfmt() [**ls**(1)](/ls/1.md) distant date format: $1$2''''''''

- **110**

  The $1$2tmfmt()tmfmt()tmfmt()tmfmt()tmfmt()tmfmt()tmfmt()tmfmt() [**date**(1)](/date/1.md) meridian date format: $1$2''''''''

- **111**

  The ERA name.

- **112**

  ERA alternative for **39**.

- **113**

  ERA alternative for **38**.

- **114**

  ERA alternative for **40**.

- **115**

  The ERA year.

- **116-125**

  Ordinal names: first, *no second!*, third, fourth, fifth, sixth, seventh, eighth, ninth, tenth.

- **126-128**

  Final time references, as in *the last in the list*: final, ending, nth.

Low level support functions and data are described in $1$2\<tm.h\>\<tm.h\>\<tm.h\>\<tm.h\>\<tm.h\>\<tm.h\>\<tm.h\>\<tm.h\>

## EXAMPLES

```
#include <tm.h>
main() {
    int       i;
    time_t    t;
    char      buf[128];
    struct {
        char* date;
        char* format;
    }         x[] = {
        "now",                 "%i",
        "2 months ago",        "%C",
        "this Wednesday noon", "%x %I:%M %p",
        "last December 25",    "%A",
        0,                     0
    };
    for (i = 0; x[i].date; i++) {
        t = tmdate(x[i].date, (char*)0, (time_t*)0);
        (void)tmfmt(buf, sizeof(buf), x[i].format, &t);
        puts(buf);
    }
}
```

produces

```
Fri Sep 30 12:10:14 USA EDT 1988
Fri Jul  1 00:00:00 EDT 1988
10/05/88 12:00 PM
Friday
```

## SEE ALSO

[**date**(1)](/date/1.md), [**time**(2)](/time/2.md), [**ctime**(3)](/ctime/3.md)

## BUGS

The C library static $1$2struct tmstruct tmstruct tmstruct tmstruct tmstruct tmstruct tmstruct tm values may get clobbered by *tm* library routines as the [**ctime**(3)](/ctime/3.md) and [**localtime**(3)](/localtime/3.md) routines typically return pointers to a single static $1$2struct tmstruct tmstruct tmstruct tmstruct tmstruct tmstruct tmstruct tm area. $1$2tmdate()tmdate()tmdate()tmdate()tmdate()tmdate()tmdate()tmdate() uses an internal international time zone name table that will probably always be incomplete.
