MG Mud User | 88f1247 | 2016-06-24 23:31:02 +0200 | [diff] [blame^] | 1 | SYNOPSIS |
| 2 | string strftime() |
| 3 | string strftime(string fmt) |
| 4 | string strftime(int clock) |
| 5 | string strftime(string fmt, int clock) |
| 6 | string strftime(string fmt, int clock, int localized) |
| 7 | |
| 8 | BESCHREIBUNG |
| 9 | Gibt, aehnliche wie ctime(), eine Zeit als formatierten String zurueck. |
| 10 | Hierbei kann ein String mit div. Platzhaltern vom Benutzer angegeben |
| 11 | werden (s.u.). Wird kein String angegeben, wird "%c" als Formatstring |
| 12 | benutzt. |
| 13 | |
| 14 | Das Argument <clock> wird als Anzahl Sekunden seit dem 01.01.1970, 00:00 |
| 15 | Uhr interpretiert. Wenn <clock> nicht angegeben wird, wird time() |
| 16 | verwendet. |
| 17 | |
| 18 | Das Argument <localized> gibt an, ob die Ausgabe englisch (das sog. |
| 19 | klassische "C" locale) oder in der jeweiligen Landessprache (z.B. |
| 20 | deutsch) erfolgen soll. Hierbei haengt die Sprache allerdings von den auf |
| 21 | dem Mudrechner gesetzten Umgebungsvariablen LC_TIME oder LC_ALL ab, sie |
| 22 | kann nicht selber gewaehlt werden. Wird kein <localized> angegeben, wird |
| 23 | 1 verwendet, was einer Ausgabe in Landessprache entspricht. |
| 24 | |
| 25 | BEMERKUNGEN: |
| 26 | Der zurueckgebene Ergebnisstring ist max. 511 Zeichen lang. |
| 27 | Im MG erfolgt momentan immer eine englische Ausgabe. |
| 28 | |
| 29 | PLATZHALTER: |
| 30 | Diese Funktion versteht alle Platzhalter, die die Funktion strftime() aus |
| 31 | der C-Standardbibliothek versteht. Momentan sind dies: |
| 32 | |
| 33 | %a |
| 34 | is replaced by the locale's abbreviated weekday name. |
| 35 | %A |
| 36 | is replaced by the locale's full weekday name. |
| 37 | %b |
| 38 | is replaced by the locale's abbreviated month name. |
| 39 | %B |
| 40 | is replaced by the locale's full month name. |
| 41 | %c |
| 42 | is replaced by the locale's appropriate date and time representation. |
| 43 | %C |
| 44 | is replaced by the century number (the year divided by 100 and |
| 45 | truncated to an integer) as a decimal number [00-99]. |
| 46 | %d |
| 47 | is replaced by the day of the month as a decimal number [01,31]. |
| 48 | %D |
| 49 | same as %m/%d/%y. |
| 50 | %e |
| 51 | is replaced by the day of the month as a decimal number [1,31]; a |
| 52 | single digit is preceded by a space. |
| 53 | %h |
| 54 | same as %b. |
| 55 | %H |
| 56 | is replaced by the hour (24-hour clock) as a decimal number |
| 57 | [00,23]. |
| 58 | %I |
| 59 | is replaced by the hour (12-hour clock) as a decimal number |
| 60 | [01,12]. |
| 61 | %j |
| 62 | is replaced by the day of the year as a decimal number |
| 63 | [001,366]. |
| 64 | %m |
| 65 | is replaced by the month as a decimal number [01,12]. |
| 66 | %M |
| 67 | is replaced by the minute as a decimal number [00,59]. |
| 68 | %n |
| 69 | is replaced by a newline character. |
| 70 | %p |
| 71 | is replaced by the locale's equivalent of either a.m. or p.m. |
| 72 | %r |
| 73 | is replaced by the time in a.m. and p.m. notation; in the POSIX |
| 74 | locale this is equivalent to %I:%M:%S %p. |
| 75 | %R |
| 76 | is replaced by the time in 24 hour notation (%H:%M). |
| 77 | %S |
| 78 | is replaced by the second as a decimal number [00,61]. |
| 79 | %t |
| 80 | is replaced by a tab character. |
| 81 | %T |
| 82 | is replaced by the time (%H:%M:%S). |
| 83 | %u |
| 84 | is replaced by the weekday as a decimal number [1,7], with 1 |
| 85 | representing Monday. |
| 86 | %U |
| 87 | is replaced by the week number of the year (Sunday as the first day |
| 88 | of the week) as a decimal number [00,53]. |
| 89 | %V |
| 90 | is replaced by the week number of the year (Monday as the first day |
| 91 | of the week) as a decimal number [01,53]. If the week containing 1 |
| 92 | January has four or more days in the new year, then it is considered |
| 93 | week 1. Otherwise, it is the last week of the previous year, and the |
| 94 | next week is week 1. |
| 95 | %w |
| 96 | is replaced by the weekday as a decimal number [0,6], with 0 |
| 97 | representing Sunday. |
| 98 | %W |
| 99 | is replaced by the week number of the year (Monday as the first day |
| 100 | of the week) as a decimal number [00,53]. All days in a new year |
| 101 | preceding the first Monday are considered to be in week 0. |
| 102 | %x |
| 103 | is replaced by the locale's appropriate date representation. |
| 104 | %X |
| 105 | is replaced by the locale's appropriate time representation. |
| 106 | %y |
| 107 | is replaced by the year without century as a decimal number [00,99]. |
| 108 | %Y |
| 109 | is replaced by the year with century as a decimal number. |
| 110 | %Z |
| 111 | is replaced by the timezone name or abbreviation, or by no bytes if |
| 112 | no timezone information exists. |
| 113 | %% |
| 114 | is replaced by %. |
| 115 | |
| 116 | BEISPIEL |
| 117 | write(strftime("Heute ist %A, der %d. %B %Y.\n")) |
| 118 | ergibt z.B. |
| 119 | "Heute ist Montag, der 24. September 2007.\n" |
| 120 | |
| 121 | SIEHE AUCH |
| 122 | gmtime(E), localtime(E), mktime(), time(E), utime(E) |