{"id":5853,"date":"2020-07-02T15:09:56","date_gmt":"2020-07-02T15:09:56","guid":{"rendered":"https:\/\/profi-tutorials.de\/linux\/?p=5853"},"modified":"2020-07-02T18:10:37","modified_gmt":"2020-07-02T18:10:37","slug":"befehl-date","status":"publish","type":"post","link":"https:\/\/profi-tutorials.de\/linux\/administration\/befehl-date\/","title":{"rendered":"Der Befehl date"},"content":{"rendered":"<p>In diesem Beitrag lernen Sie den Befehl date unter Linux-\/UNIX-Betriebssystemen kennen. Der Befehl erm&ouml;glicht Ihnen die Ausgabe sowie Konfiguration der Zeit- und Datums-Information des Systems.<\/p>\n<h2 id=\"t-1593613404618\">Allgemeine Syntax<\/h2>\n<p>Die allgemeine <a class=\"glossaryLink cmtt_Allgemein cmtt_Informatik\" aria-describedby=\"tt\" data-cmtooltip=\"&lt;div class=glossaryItemTitle&gt;Syntax&lt;\/div&gt;&lt;div class=glossaryItemBody&gt;&#8203;Im  Allgemeinen wird unter Syntax ein Regel&#8203;system verstanden, welches zur  Kombination elementarer Zeichen zu zusammengesetzten &#8203;Zeichen in (...)&lt;\/div&gt;\" href=\"https:\/\/profi-tutorials.de\/linux\/glossar\/syntax\/\" target=\"_blank\" data-mobile-support=\"0\" data-gt-translate-attributes='[{\"attribute\":\"data-cmtooltip\", \"format\":\"html\"}]' tabindex=\"0\" role=\"link\">Syntax<\/a> des Befehls lautet folgenderma&szlig;en:<\/p>\n<pre>date [Optionen] \"+[Format]\"<\/pre>\n<p>Zur Verwendung bestimmter Optionen wird eine andere Syntax ben&ouml;tigt:<\/p>\n<pre>date [-u \/ --utc \/ --universal] [MMDDhhmm[[CC]YY][.ss]]<\/pre>\n<p>Wird der Befehl ohne jegliche Optionen ausgef&uuml;hrt, so gibt er einfach die Systemzeit, also Datum und Uhrzeit, in einem festen Format aus. Es folgt ein kurzes Beispiel f&uuml;r die Anwendung des Befehls ohne Optionen.<\/p>\n<h5>Beispiel: date ohne Optionen<\/h5>\n<p>Dieses Beispiel zeigt kurz die Funktionsweise des Befehls <strong>date <\/strong>ohne Optionen.<\/p>\n<h6>Eingabe:<\/h6>\n<p>date<\/p>\n<h6>Ausgabe:<\/h6>\n<p>Mi 1. Jul 16:45:00 CEST 2020<\/p>\n<h2 id=\"t-1593613404619\">Wichtige Optionen<\/h2>\n<p>Der Befehl <strong>date <\/strong>besitzt eine Vielzahl an Optionen, welche verwendet werden k&ouml;nnen, um beispielsweise das Ausgabeformat anzupassen oder die Systemzeit festzulegen. Im Folgenden werden einige der wichtigsten dieser Optionen kurz vorgestellt.<\/p>\n<h3 id=\"t-1593617360535\">-d &ndash; Bestimmte Zeit ausgeben<\/h3>\n<p>Mit der <strong>Option -d<\/strong> ist es m&ouml;glich, eine bestimmte durch einen gegebenen <strong>String <\/strong>definierte Zeit auszugeben. Der ben&ouml;tigte String kann in einem relativ freien, menschen-lesbaren Format angegeben werden &ndash; Lesen Sie hierzu auch den Abschnitt <strong>&ldquo;Das date-String Format&rdquo;<\/strong> in diesem Beitrag.<\/p>\n<pre>date -d [String]<\/pre>\n<h5>Beispiel: Option -d<\/h5>\n<p>In diesem Beispiel wird mit der <strong>Option -d<\/strong> das Datum f&uuml;r den n&auml;chsten Mittwoch angezeigt.<\/p>\n<h6>Eingabe:<\/h6>\n<p>date -d &ldquo;next wednesday&rdquo;<\/p>\n<h6>Ausgabe:<\/h6>\n<p style=\"\">Das Format der Ausgabe wird automatisch auf Grundlage des Systemgebietsschema gew&auml;hlt. Da keine Uhrzeit angegeben wurde, wird diese auf <strong>00:00:00<\/strong> gesetzt.<\/p>\n<p>Mi 8. Jul 00:00:00 CEST 2020<\/p>\n<h3 id=\"t-1593617360536\">-f &ndash; Zeiten aus Datei ausgeben<\/h3>\n<p>Die <strong>Option -f<\/strong> funktioniert analog zur <strong>Option -d<\/strong>: Die Zeiten-Strings werden hierbei jedoch aus einer <strong>Datei <\/strong><strong>ausgelesen<\/strong>:<\/p>\n<pre>date -f [Datei]<\/pre>\n<h5>Beispiel: Option -f<\/h5>\n<p>Hier sollen mit der <strong>Option -f<\/strong> mehrere Strings zeilenweise aus einer Datei ausgelesen und als Datum ausgegeben werden.<\/p>\n<p>Im Folgenden wird zun&auml;chst der Inhalt einer Datei <strong>&ldquo;strings.txt&rdquo;<\/strong> gezeigt, welche im Anschluss dem Befehl &uuml;bergeben wird.<\/p>\n<h6>Inhalt &ldquo;strings.txt&rdquo;:<\/h6>\n<p>Jul 1 00:00:42 CEST 20252024-02-02 00:18:00Zlast thursdayyesterday<\/p>\n<h6>Eingabe:<\/h6>\n<p>date -f strings.txt<\/p>\n<h6>Ausgabe:<\/h6>\n<p>Di 1. Jul 00:00:42 CEST 2025Fr 2. Feb 01:18:00 CET 2024Do 25. Jun 00:00:00 CEST 2020Mi 1. Jul 16:16:23 CEST 2020<\/p>\n<h3 id=\"t-1593617360537\">-I &ndash; Ausgabe nach ISO 8601<\/h3>\n<p>Auch mit der <strong>Option -I<\/strong> ist die Ausgabe der Zeit m&ouml;glich. Hierbei wird jedoch die aktuelle Zeit im <strong><a class=\"glossaryLink cmtt_Allgemein\"  aria-describedby=\"tt\"  data-cmtooltip=\"&lt;div class=glossaryItemTitle&gt;ISO [International Standard Organisation]&lt;\/div&gt;&lt;div class=glossaryItemBody&gt;ISO steht f&uuml;r International Standard Organisation - praktisch das weltweite Gremium f&uuml;r Standardisierung.&lt;\/div&gt;\"  href=\"https:\/\/profi-tutorials.de\/linux\/glossar\/iso\/\"  target=\"_blank\"  data-mobile-support=\"0\"  data-gt-translate-attributes='[{\"attribute\":\"data-cmtooltip\", \"format\":\"html\"}]' tabindex='0' role='link'>ISO<\/a> 8601 Format<\/strong> ausgegeben. Durch die <a class=\"glossaryLink cmtt_Allgemein cmtt_Informatik\" aria-describedby=\"tt\" data-cmtooltip=\"&lt;div class=glossaryItemTitle&gt;Konkatenation&lt;\/div&gt;&lt;div class=glossaryItemBody&gt;Die Konkatenation ist die Verkn&uuml;pfung zweier Worte zu einem neuen Wort.&lt;\/div&gt;\" href=\"https:\/\/profi-tutorials.de\/linux\/glossar\/konkatenation\/\" target=\"_blank\" data-mobile-support=\"0\" data-gt-translate-attributes='[{\"attribute\":\"data-cmtooltip\", \"format\":\"html\"}]' tabindex=\"0\" role=\"link\">Konkatenation<\/a> verschiedener <a class=\"glossaryLink cmtt_Allgemein cmtt_Informatik\" aria-describedby=\"tt\" data-cmtooltip=\"&lt;div class=glossaryItemTitle&gt;Wort&lt;\/div&gt;&lt;div class=glossaryItemBody&gt;Ein Wort ist in der Informatik eine endliche Folge &uuml;ber einem Alphabet.&lt;\/div&gt;\" href=\"https:\/\/profi-tutorials.de\/linux\/glossar\/wort\/\" target=\"_blank\" data-mobile-support=\"0\" data-gt-translate-attributes='[{\"attribute\":\"data-cmtooltip\", \"format\":\"html\"}]' tabindex=\"0\" role=\"link\">Worte<\/a> <strong>[FMT]<\/strong> direkt an das Ende der Option (keine Leerzeichen!) k&ouml;nnen Sie zudem die <strong>Genauigkeit der Ausgabe<\/strong> zu bestimmen. M&ouml;glich sind <strong>&lsquo;hours&rsquo;<\/strong> bzw- <strong>&lsquo;h&rsquo;<\/strong>, <strong>&lsquo;minutes&rsquo;<\/strong> bzw. <strong>&lsquo;m&rsquo;<\/strong>, <strong>&lsquo;seconds&rsquo;<\/strong> bzw. <strong>&lsquo;s&rsquo;<\/strong> und schlie&szlig;lich <strong>&lsquo;ns&rsquo;<\/strong>.<\/p>\n<pre>date -I[FMT]<\/pre>\n<h5>Beispiel: Option -I (Ausgabe nach ISO 8601)<\/h5>\n<p>Dieses Beispiel zeigt die Ausgabe des aktuellen Datums im Format nach ISO 8601.<\/p>\n<h6>Eingabe:<\/h6>\n<p>date -I<\/p>\n<h6>Ausgabe:<\/h6>\n<p>2020-07-02<\/p>\n<h5>Beispiel: Option -I (Ausgabe nach ISO 8601) mit Pr&auml;zisionsangabe<\/h5>\n<p>Auch hier wird das aktuelle Datum im Format nach ISO 8601 ausgegeben. Die Pr&auml;zision wird mit einem <strong>&lsquo;h&rsquo;<\/strong>&nbsp;auf Stunden gesetzt.<\/p>\n<h6>Eingabe:<\/h6>\n<p>date -Ih<\/p>\n<h6>Ausgabe:<\/h6>\n<p>2020-07-02T16+02:00<\/p>\n<h3 id=\"t-1593617360538\">-R &ndash; Ausgabe nach RFC 2822<\/h3>\n<p>Die <strong>Option -R<\/strong> gibt die Zeit im <strong><a class=\"glossaryLink cmtt_Informatik cmtt_Netzwerke\"  aria-describedby=\"tt\"  data-cmtooltip=\"&lt;div class=glossaryItemTitle&gt;RFC [Request For Comments]&lt;\/div&gt;&lt;div class=glossaryItemBody&gt;RFC steht f&uuml;r Request For Comments und stellt eine Reihe technischer und organisatorischer Dokumente &uuml;ber das Internet dar.&lt;\/div&gt;\"  href=\"https:\/\/profi-tutorials.de\/linux\/glossar\/rfc\/\"  target=\"_blank\"  data-mobile-support=\"0\"  data-gt-translate-attributes='[{\"attribute\":\"data-cmtooltip\", \"format\":\"html\"}]' tabindex='0' role='link'>RFC<\/a> 2822 Format<\/strong> aus.<\/p>\n<pre>date -R<\/pre>\n<h5>Beispiel: Option -R (Ausgabe nach RFC 2822)<\/h5>\n<p>Dieses Beispiel zeigt die Ausgabe der aktuellen Zeit im Format nach RFC 2822.<\/p>\n<h6>Eingabe:<\/h6>\n<p>date -R<\/p>\n<h6>Ausgabe:<\/h6>\n<p>Thu, 02 Jul 2020 16:25:56 +0200<\/p>\n<h3 id=\"t-1593617360539\">-s &ndash; Datum \/ Zeit festlegen<\/h3>\n<p>Die <strong>Option -s<\/strong> wird verwendet, um die <strong>Systemzeit <\/strong>auf einen beliebigen durch einen <strong>String <\/strong>spezifizierten Wert zu <strong>setzen<\/strong>. Es wird wieder die im Abschnitt <strong>&ldquo;Das date-String Format&rdquo;<\/strong> gezeigte Formatierung ben&ouml;tigt.<\/p>\n<pre>date -s [String]<\/pre>\n<h5>Beispiel: Option -s<\/h5>\n<p>In diesem Beispiel soll die Uhrzeit um einen Tag zur&uuml;ckgestellt werden. Das aktuelle Datum bzw. die aktuelle Uhrzeit ist <strong>&ldquo;Do 2. Jul 16:28:43 CEST 2020&rdquo;<\/strong>.<\/p>\n<h6>Eingabe:<\/h6>\n<p>date -s &ldquo;1 day ago&rdquo;<\/p>\n<h6>Ausgabe:<\/h6>\n<p style=\"\">In der Ausgabe ist zu sehen, dass die Zeit um genau einen Tag zur&uuml;ckgestellt wurde.<\/p>\n<p>Mi 1. Jul 16:30:07 CEST 2020<\/p>\n<h5>Beispiel: Option -s<\/h5>\n<p>Hier soll die Zeit auf einen genau spezifizierten Wert gestellt werden.<\/p>\n<h6>Eingabe:<\/h6>\n<p>date -s &ldquo;2020-07-01 15:30:00 CEST&rdquo;<\/p>\n<h6>Ausgabe:<\/h6>\n<p>In der Ausgabe ist zu sehen, dass die Zeit um genau einen Tag zur&uuml;ckgestellt wurde.<\/p>\n<p>Mi 1. Jul 15:30:00 CEST 2020<\/p>\n<h3 id=\"t-1593617360540\">-u &ndash; Ausgabe \/ Setzen der UTC<\/h3>\n<p>Schlie&szlig;lich k&ouml;nnen Sie mit der <strong>Option -u<\/strong> die koordinierte Weltzeit ausgeben:<\/p>\n<pre>date -u<\/pre>\n<h5>Beispiel: Option -u<\/h5>\n<p>Die Option -u wird hier verwendet, um die koordinierte Weltzeit (UTC) auszugeben.<\/p>\n<h6>Eingabe:<\/h6>\n<p>date -u<\/p>\n<h6>Ausgabe:<\/h6>\n<p>Do 2. Jul 14:43:31 UTC 2020<\/p>\n<h2 id=\"t-1593695637324\">Das date-String Format<\/h2>\n<p>Die String-Angaben, beispielsweise bei den <strong>Optionen -d<\/strong> und <strong>-s<\/strong>, werden in einem menschen-lesbaren Format gemacht. Die <a class=\"glossaryLink cmtt_Allgemein cmtt_Informatik\" aria-describedby=\"tt\" data-cmtooltip=\"&lt;div class=glossaryItemTitle&gt;String&lt;\/div&gt;&lt;div class=glossaryItemBody&gt;Ein String ist in der Informatik eine Zeichenkette - stellt also eine endliche Folge von Zeichen aus einem bestimmten Zeichensatz,(...)&lt;\/div&gt;&lt;div class=cmtt_synonyms_wrapper&gt;&lt;div class=cmtt_synonyms_title&gt;Synonyms: &lt;\/div&gt;&lt;div class=cmtt_synonyms&gt;Zeichenkette&lt;\/div&gt;&lt;\/div&gt;\" href=\"https:\/\/profi-tutorials.de\/linux\/glossar\/string\/\" target=\"_blank\" data-mobile-support=\"0\" data-gt-translate-attributes='[{\"attribute\":\"data-cmtooltip\", \"format\":\"html\"}]' tabindex=\"0\" role=\"link\">Zeichenkette<\/a> darf Angaben zum Datum und Wochentag, der Uhrzeit, Zeitzone und vielen weiteren Daten enthalten.<\/p>\n<p>Beispielsweise kann ein date-String etwa folgenderma&szlig;en aussehen: &ldquo;Jul 1 00:00:42 CEST 2025&rdquo;. Es sind aber auch w&ouml;rtliche Angaben, wie zum Beispiel &ldquo;yesterday&rdquo;, &ldquo;tomorrow&rdquo;, &ldquo;last friday&rdquo; oder &ldquo;next monday&rdquo;, m&ouml;glich.<\/p>\n<p>Die genaue Beschreibung aller m&ouml;glichen Formate und Angaben w&uuml;rde den Rahmen dieses Beitrags sprengen, jedoch finden Sie auf der info-Seite des date-Befehls eine genaue Dokumentation hierzu. Sie erreichen die info-Seite unter Eingabe des folgenden Befehls:<\/p>\n<pre>info date<\/pre>\n<h2 id=\"t-1593617360541\">Formatangaben (Ausgabe)<\/h2>\n<p>Im Folgenden werden alle verf&uuml;gbaren Sequenzen aufgelistet, welche f&uuml;r Formatangaben in <strong>[Format]<\/strong>-Feldern verwendet werden k&ouml;nnen.<\/p>\n<h3 id=\"t-1593617360543\">Verf&uuml;gbare Sequenzen<\/h3>\n<table data-rows=\"25\" data-cols=\"4\" data-v=\"middle\">\n<thead>\n<tr>\n<th style=\"padding: 0px; width: 80px;\"><strong>Sequenz<\/strong><\/th>\n<th style=\"padding: 0px;\">Ausgabe<\/th>\n<th style=\"padding: 0px;\" colspan=\"1\" rowspan=\"1\"><strong>Sequenz<\/strong><\/th>\n<th style=\"padding: 0px;\" colspan=\"1\" rowspan=\"1\">Ausgabe<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td data-th=\"Sequenz\" style=\"padding: 0px;\">%a<\/td>\n<td data-th=\"Ausgabe\" style=\"padding: 0px;\">Gek&uuml;rzter Wochentag nach Systemgebietsschema<\/td>\n<td data-th=\"Sequenz\" style=\"padding: 0px;\" colspan=\"1\" rowspan=\"1\">%A<\/td>\n<td data-th=\"Ausgabe\" style=\"padding: 0px;\" colspan=\"1\" rowspan=\"1\">Voller Wochentag nach Systemgebietsschema<\/td>\n<\/tr>\n<tr>\n<td data-th=\"Sequenz\" style=\"padding: 0px;\">%b<\/td>\n<td data-th=\"Ausgabe\" style=\"padding: 0px;\">Gek&uuml;rzter Monat nach Systemgebietsschema<\/td>\n<td data-th=\"Sequenz\" style=\"padding: 0px;\" colspan=\"1\" rowspan=\"1\">%B<\/td>\n<td data-th=\"Ausgabe\" style=\"padding: 0px;\" colspan=\"1\" rowspan=\"1\">Voller Monat nach Systemgebietsschema<\/td>\n<\/tr>\n<tr>\n<td data-th=\"Sequenz\" style=\"padding: 0px;\">%c<\/td>\n<td data-th=\"Ausgabe\" style=\"padding: 0px;\">Datum und Uhrzeit nach Systemgebietsschema<\/td>\n<td data-th=\"Sequenz\" style=\"padding: 0px;\" colspan=\"1\" rowspan=\"1\">%C<\/td>\n<td data-th=\"Ausgabe\" style=\"padding: 0px;\" colspan=\"1\" rowspan=\"1\">Jahrhundert<\/td>\n<\/tr>\n<tr>\n<td data-th=\"Sequenz\" style=\"padding: 0px;\">%d<\/td>\n<td data-th=\"Ausgabe\" style=\"padding: 0px;\">Tag im Monat (z.B. 07)<\/td>\n<td data-th=\"Sequenz\" style=\"padding: 0px;\" colspan=\"1\" rowspan=\"1\">%D<\/td>\n<td data-th=\"Ausgabe\" style=\"padding: 0px;\" colspan=\"1\" rowspan=\"1\">Datum (wie: %m\/%d\/%y)<\/td>\n<\/tr>\n<tr>\n<td data-th=\"Sequenz\" style=\"padding: 0px;\" rowspan=\"1\" colspan=\"1\">%e<\/td>\n<td data-th=\"Ausgabe\" style=\"padding: 0px;\" rowspan=\"1\" colspan=\"1\">Tag im Monat mit Padding (wie %_d)<\/td>\n<td data-th=\"Sequenz\" style=\"padding: 0px;\" colspan=\"1\" rowspan=\"1\">%F<\/td>\n<td data-th=\"Ausgabe\" style=\"padding: 0px;\" colspan=\"1\" rowspan=\"1\">Volles Datum (wie %+4Y-%m-%d)<\/td>\n<\/tr>\n<tr>\n<td data-th=\"Sequenz\" style=\"padding: 0px;\" rowspan=\"1\" colspan=\"1\">%g<\/td>\n<td data-th=\"Ausgabe\" style=\"padding: 0px;\" rowspan=\"1\" colspan=\"1\">Letzte zwei Zeichen der Jahreszahl<\/td>\n<td data-th=\"Sequenz\" style=\"padding: 0px;\" colspan=\"1\" rowspan=\"1\">%G<\/td>\n<td data-th=\"Ausgabe\" style=\"padding: 0px;\" colspan=\"1\" rowspan=\"1\">Volles Jahr<\/td>\n<\/tr>\n<tr>\n<td data-th=\"Sequenz\" style=\"padding: 0px;\" rowspan=\"1\" colspan=\"1\">%h<\/td>\n<td data-th=\"Ausgabe\" style=\"padding: 0px;\" rowspan=\"1\" colspan=\"1\">Genauso wie %b<\/td>\n<td data-th=\"Sequenz\" style=\"padding: 0px;\" colspan=\"1\" rowspan=\"1\">%H<\/td>\n<td data-th=\"Ausgabe\" style=\"padding: 0px;\" colspan=\"1\" rowspan=\"1\">Stunde (24h Format)<\/td>\n<\/tr>\n<tr>\n<td data-th=\"Sequenz\" style=\"padding: 0px;\" rowspan=\"1\" colspan=\"1\">%I<\/td>\n<td data-th=\"Ausgabe\" style=\"padding: 0px;\" rowspan=\"1\" colspan=\"1\">Stunde (12h Format)<\/td>\n<td data-th=\"Sequenz\" style=\"padding: 0px;\" colspan=\"1\" rowspan=\"1\">%j<\/td>\n<td data-th=\"Ausgabe\" style=\"padding: 0px;\" colspan=\"1\" rowspan=\"1\">Tag im Jahr (001-366)<\/td>\n<\/tr>\n<tr>\n<td data-th=\"Sequenz\" style=\"padding: 0px;\" rowspan=\"1\" colspan=\"1\">%k<\/td>\n<td data-th=\"Ausgabe\" style=\"padding: 0px;\" rowspan=\"1\" colspan=\"1\">Stunde (24h Format) mit Padding (wie %_H)<\/td>\n<td data-th=\"Sequenz\" style=\"padding: 0px;\" colspan=\"1\" rowspan=\"1\">%l<\/td>\n<td data-th=\"Ausgabe\" style=\"padding: 0px;\" colspan=\"1\" rowspan=\"1\">Stunde (12h Format) mit Padding (wie %_H)<\/td>\n<\/tr>\n<tr>\n<td data-th=\"Sequenz\" style=\"padding: 0px;\" rowspan=\"1\" colspan=\"1\">%m<\/td>\n<td data-th=\"Ausgabe\" style=\"padding: 0px;\" rowspan=\"1\" colspan=\"1\">Monat (01-12)<\/td>\n<td data-th=\"Sequenz\" style=\"padding: 0px;\" colspan=\"1\" rowspan=\"1\">%M<\/td>\n<td data-th=\"Ausgabe\" style=\"padding: 0px;\" colspan=\"1\" rowspan=\"1\">Minute (00-59)<\/td>\n<\/tr>\n<tr>\n<td data-th=\"Sequenz\" style=\"padding: 0px;\" rowspan=\"1\" colspan=\"1\">%n<\/td>\n<td data-th=\"Ausgabe\" style=\"padding: 0px;\" rowspan=\"1\" colspan=\"1\">Neue Zeile<\/td>\n<td data-th=\"Sequenz\" style=\"padding: 0px;\" colspan=\"1\" rowspan=\"1\">%N<\/td>\n<td data-th=\"Ausgabe\" style=\"padding: 0px;\" colspan=\"1\" rowspan=\"1\">Nanosekunden (000000000-999999999)<\/td>\n<\/tr>\n<tr>\n<td data-th=\"Sequenz\" style=\"padding: 0px;\" rowspan=\"1\" colspan=\"1\">%p<\/td>\n<td data-th=\"Ausgabe\" style=\"padding: 0px;\" rowspan=\"1\" colspan=\"1\">AM\/PM-Zeit nach Systemgebietsschema (Wenn unbekannt: Leer)<\/td>\n<td data-th=\"Sequenz\" style=\"padding: 0px;\" colspan=\"1\" rowspan=\"1\">%P<\/td>\n<td data-th=\"Ausgabe\" style=\"padding: 0px;\" colspan=\"1\" rowspan=\"1\">Genauso wie %p aber Kleinschreibung<\/td>\n<\/tr>\n<tr>\n<td data-th=\"Sequenz\" style=\"padding: 0px;\" rowspan=\"1\" colspan=\"1\">%q<\/td>\n<td data-th=\"Ausgabe\" style=\"padding: 0px;\" rowspan=\"1\" colspan=\"1\">Viertel des Jahres (1-4)<\/td>\n<td data-th=\"Sequenz\" style=\"padding: 0px;\" colspan=\"1\" rowspan=\"1\">&#8203;<\/td>\n<td data-th=\"Ausgabe\" style=\"padding: 0px;\" colspan=\"1\" rowspan=\"1\">Cell<\/td>\n<\/tr>\n<tr>\n<td data-th=\"Sequenz\" style=\"padding: 0px;\" rowspan=\"1\" colspan=\"1\">%r<\/td>\n<td data-th=\"Ausgabe\" style=\"padding: 0px;\" rowspan=\"1\" colspan=\"1\">12h Uhrzeit nach Systemgebietsschema<\/td>\n<td data-th=\"Sequenz\" style=\"padding: 0px;\" colspan=\"1\" rowspan=\"1\">%R<\/td>\n<td data-th=\"Ausgabe\" style=\"padding: 0px;\" colspan=\"1\" rowspan=\"1\">24h Uhrzeit (Stunde und Minute) (wie %H:%M)<\/td>\n<\/tr>\n<tr>\n<td data-th=\"Sequenz\" style=\"padding: 0px;\" rowspan=\"1\" colspan=\"1\">%s<\/td>\n<td data-th=\"Ausgabe\" style=\"padding: 0px;\" rowspan=\"1\" colspan=\"1\">Timestamp in Sekunden seit dem 01.01.1970 um Mitternacht<\/td>\n<td data-th=\"Sequenz\" style=\"padding: 0px;\" colspan=\"1\" rowspan=\"1\">%S<\/td>\n<td data-th=\"Ausgabe\" style=\"padding: 0px;\" colspan=\"1\" rowspan=\"1\">Sekunde (00-60)<\/td>\n<\/tr>\n<tr>\n<td data-th=\"Sequenz\" style=\"padding: 0px;\" rowspan=\"1\" colspan=\"1\">%t<\/td>\n<td data-th=\"Ausgabe\" style=\"padding: 0px;\" rowspan=\"1\" colspan=\"1\">Tab<\/td>\n<td data-th=\"Sequenz\" style=\"padding: 0px;\" colspan=\"1\" rowspan=\"1\">%T<\/td>\n<td data-th=\"Ausgabe\" style=\"padding: 0px;\" colspan=\"1\" rowspan=\"1\">Zeit (wie %H:%M:%S)<\/td>\n<\/tr>\n<tr>\n<td data-th=\"Sequenz\" style=\"padding: 0px;\" rowspan=\"1\" colspan=\"1\">%u<\/td>\n<td data-th=\"Ausgabe\" style=\"padding: 0px;\" rowspan=\"1\" colspan=\"1\">Tag der Woche (1-7, wobei 1 Montag ist)<\/td>\n<td data-th=\"Sequenz\" style=\"padding: 0px;\" colspan=\"1\" rowspan=\"1\">%U<\/td>\n<td data-th=\"Ausgabe\" style=\"padding: 0px;\" colspan=\"1\" rowspan=\"1\">Wochennummer des Jahres, wobei Sonntag erster Tag der Woche ist (00-53)<\/td>\n<\/tr>\n<tr>\n<td data-th=\"Sequenz\" style=\"padding: 0px;\" rowspan=\"1\" colspan=\"1\">%V<\/td>\n<td data-th=\"Ausgabe\" style=\"padding: 0px;\" rowspan=\"1\" colspan=\"1\">ISO Wochennummer mit Montag als erster Tag der Woche (01-53)<\/td>\n<td data-th=\"Sequenz\" style=\"padding: 0px;\" colspan=\"1\" rowspan=\"1\">Cell<\/td>\n<td data-th=\"Ausgabe\" style=\"padding: 0px;\" colspan=\"1\" rowspan=\"1\">Cell<\/td>\n<\/tr>\n<tr>\n<td data-th=\"Sequenz\" style=\"padding: 0px;\" rowspan=\"1\" colspan=\"1\">%w<\/td>\n<td data-th=\"Ausgabe\" style=\"padding: 0px;\" rowspan=\"1\" colspan=\"1\">Tag der Woche (0-6, wobei 0 Sonntag ist)<\/td>\n<td data-th=\"Sequenz\" style=\"padding: 0px;\" colspan=\"1\" rowspan=\"1\">%W<\/td>\n<td data-th=\"Ausgabe\" style=\"padding: 0px;\" colspan=\"1\" rowspan=\"1\">Wochennummer des Jahres, wobei Montag erster Tag der Woche ist (00-53)<\/td>\n<\/tr>\n<tr>\n<td data-th=\"Sequenz\" style=\"padding: 0px;\" rowspan=\"1\" colspan=\"1\">%x<\/td>\n<td data-th=\"Ausgabe\" style=\"padding: 0px;\" rowspan=\"1\" colspan=\"1\">Datum, dargestellt nach Systemgebietsschema<\/td>\n<td data-th=\"Sequenz\" style=\"padding: 0px;\" colspan=\"1\" rowspan=\"1\">%X<\/td>\n<td data-th=\"Ausgabe\" style=\"padding: 0px;\" colspan=\"1\" rowspan=\"1\">Zeit, dargestellt nach Systemgebietsschema<\/td>\n<\/tr>\n<tr>\n<td data-th=\"Sequenz\" style=\"padding: 0px;\" rowspan=\"1\" colspan=\"1\">%y<\/td>\n<td data-th=\"Ausgabe\" style=\"padding: 0px;\" rowspan=\"1\" colspan=\"1\">Letzte zwei Zeichen der Jahreszahl (00-99)<\/td>\n<td data-th=\"Sequenz\" style=\"padding: 0px;\" colspan=\"1\" rowspan=\"1\">%Y<\/td>\n<td data-th=\"Ausgabe\" style=\"padding: 0px;\" colspan=\"1\" rowspan=\"1\">Jahr<\/td>\n<\/tr>\n<tr>\n<td data-th=\"Sequenz\" style=\"padding: 0px;\" rowspan=\"1\" colspan=\"1\">%z<\/td>\n<td data-th=\"Ausgabe\" style=\"padding: 0px;\" rowspan=\"1\" colspan=\"1\">numerische Zeitzone (+hhmm)<\/td>\n<td data-th=\"Sequenz\" style=\"padding: 0px;\" colspan=\"1\" rowspan=\"1\">%:z<\/td>\n<td data-th=\"Ausgabe\" style=\"padding: 0px;\" colspan=\"1\" rowspan=\"1\">numerische Zeitzone (+hh:mm)<\/td>\n<\/tr>\n<tr>\n<td data-th=\"Sequenz\" style=\"padding: 0px;\" rowspan=\"1\" colspan=\"1\">%::z<\/td>\n<td data-th=\"Ausgabe\" style=\"padding: 0px;\" rowspan=\"1\" colspan=\"1\">numerische Zeitzone (+hh:mm:ss)<\/td>\n<td data-th=\"Sequenz\" style=\"padding: 0px;\" colspan=\"1\" rowspan=\"1\">%:::z<\/td>\n<td data-th=\"Ausgabe\" style=\"padding: 0px;\" colspan=\"1\" rowspan=\"1\">numerische Zeitzone mit : bis zur notwendigen Pr&auml;zision<\/td>\n<\/tr>\n<tr>\n<td data-th=\"Sequenz\" style=\"padding: 0px;\" rowspan=\"1\" colspan=\"1\">%Z<\/td>\n<td data-th=\"Ausgabe\" style=\"padding: 0px;\" rowspan=\"1\" colspan=\"1\">Alphanumerische Zeitzonen-Abk&uuml;rzung<\/td>\n<td data-th=\"Sequenz\" style=\"padding: 0px;\" colspan=\"1\" rowspan=\"1\">%%<\/td>\n<td data-th=\"Ausgabe\" style=\"padding: 0px;\" colspan=\"1\" rowspan=\"1\">Prozentzeichen %<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h5>Beispiel: Format-Sequenzen<\/h5>\n<p>Hierbei sollen einige der Sequenzen verwendet werden, um die aktuelle Kalenderwoche und Uhrzeit auszugeben.<\/p>\n<h6>Eingabe:<\/h6>\n<p>date &ldquo;+KW:%V Uhrzeit:%H:%M:%S&rdquo;<\/p>\n<h6>Ausgabe:<\/h6>\n<p>KW:27 Uhrzeit:16:48:43<\/p>\n<h3 id=\"t-1593617360542\">Optionale Flags<\/h3>\n<p>Standardm&auml;&szlig;ig verwendet date bei numerischen Angaben das Zero-Padding (Null-Padding). Dieses Verhalten kann durch Anf&uuml;gen optionaler Flags hinter dem Prozentzeichen &lsquo;%&rsquo; ver&auml;ndert werden.<\/p>\n<p>Die folgenden optionalen Flags sind verf&uuml;gbar:<\/p>\n<table data-rows=\"7\" data-cols=\"2\" data-v=\"middle\">\n<thead>\n<tr>\n<th style=\"\"><strong>Flag<\/strong><\/th>\n<th style=\"\">Funktion<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td data-th=\"Flag\" style=\"\">&ndash;<\/td>\n<td data-th=\"Funktion\" style=\"\">Kein Padding verwenden<\/td>\n<\/tr>\n<tr>\n<td data-th=\"Flag\" style=\"\">_<\/td>\n<td data-th=\"Funktion\" style=\"\">Padding mit Leerzeichen<\/td>\n<\/tr>\n<tr>\n<td data-th=\"Flag\" style=\"\">0<\/td>\n<td data-th=\"Funktion\" style=\"\">Padding mit Nullen<\/td>\n<\/tr>\n<tr>\n<td data-th=\"Flag\" style=\"\">+<\/td>\n<td data-th=\"Funktion\" style=\"\">Padding mit Nullen, Zuk&uuml;nftigen Jahren mit mehr als 4 Ziffern ein &lsquo;+&rsquo; voranstellen<\/td>\n<\/tr>\n<tr>\n<td data-th=\"Flag\" style=\"\" rowspan=\"1\" colspan=\"1\">^<\/td>\n<td data-th=\"Funktion\" style=\"\" rowspan=\"1\" colspan=\"1\">Wenn m&ouml;glich, Gro&szlig;schreibung verwenden<\/td>\n<\/tr>\n<tr>\n<td data-th=\"Flag\" style=\"\" rowspan=\"1\" colspan=\"1\">#<\/td>\n<td data-th=\"Funktion\" style=\"\" rowspan=\"1\" colspan=\"1\">Wenn m&ouml;glich, umgekehrten Fall verwenden<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>Nach jedem Flag kann optional auch eine Feldbreite in Form einer Dezimalzahl angegeben werden. Hinter einer Feldbreiten-Angabe kann zudem auch ein optionaler Modifier folgen, welcher entweder die Nutzung der <strong>alternativen Repr&auml;sentationen- (&lsquo;E&rsquo;)<\/strong>, oder der&nbsp;<strong>alternativen numerischen Symbole (&lsquo;0&rsquo;)<\/strong> nach Systemgebietsschema &ndash; wenn verf&uuml;gbar &ndash; aktiviert.<\/p>\n<h5>Beispiel: Optionale Flags<\/h5>\n<p>Zuletzt sollen hier einmal die optionalen Flags eingesetzt werden, um das Padding vollst&auml;ndig auszuschalten.<\/p>\n<p>Zun&auml;chst wird beispielhaft die Darstellung mit Zero-Padding gezeigt.<\/p>\n<h6>Eingabe:<\/h6>\n<p>date &ldquo;+%d&rdquo;<\/p>\n<h6>Ausgabe:<\/h6>\n<p style=\"\">Der aktuelle Tag im Monat wird hierbei mit Nullen auf zwei Stellen &ldquo;aufgef&uuml;llt&rdquo;.<\/p>\n<p>02<\/p>\n<p>Nun wird der <strong>optionale Flag &lsquo;-&lsquo;<\/strong> hinter dem &nbsp;Prozentzeichen eingesetzt.<\/p>\n<h6>Eingabe:<\/h6>\n<p>date &ldquo;+%-d&rdquo;<\/p>\n<h6>Ausgabe:<\/h6>\n<p style=\"\">Nach Hinzuf&uuml;gen des <strong>optionalen Flag<\/strong> wird <strong>keine <\/strong><strong>Null <\/strong>mehr angef&uuml;gt. Die Ausgabe ist damit nun einstellig.<\/p>\n<p>2<\/p>\n<p style=\"text-align: center;\">Abonniere JETZT unseren Newsletter!<\/p>\n<p style=\"text-align: center;\">Verpasse nie wieder <strong>neue<\/strong> Beitr&auml;ge und <strong>exklusive Insider-Only-Inhalte!<\/strong><\/p>\n","protected":false},"excerpt":{"rendered":"<p>In diesem Beitrag lernen Sie den Befehl date unter Linux-\/UNIX-Betriebssystemen kennen. Der Befehl erm\u00f6glicht Ihnen die Ausgabe sowie Konfiguration der Zeit- und Datums-Information des Systems. Allgemeine Syntax Die allgemeine Syntax des Befehls lautet folgenderma\u00dfen: Zur Verwendung bestimmter Optionen wird eine andere Syntax ben\u00f6tigt: Wird der Befehl ohne jegliche Optionen ausgef\u00fchrt, so gibt er einfach die [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":5993,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_seopress_robots_primary_cat":"none","_seopress_titles_title":" %%post_title%% %%sep%% %%sitetitle%%","_seopress_titles_desc":"In diesem Beitrag lernen Sie den Befehl date unter Linux-\/UNIX-Betriebssystemen kennen, welcher Ihnen die Ausgabe bzw. Konfiguration von Datum und Zeit erlaubt.","_seopress_robots_index":"","footnotes":""},"categories":[8],"tags":[],"class_list":["post-5853","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-administration"],"_links":{"self":[{"href":"https:\/\/profi-tutorials.de\/linux\/wp-json\/wp\/v2\/posts\/5853","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/profi-tutorials.de\/linux\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/profi-tutorials.de\/linux\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/profi-tutorials.de\/linux\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/profi-tutorials.de\/linux\/wp-json\/wp\/v2\/comments?post=5853"}],"version-history":[{"count":132,"href":"https:\/\/profi-tutorials.de\/linux\/wp-json\/wp\/v2\/posts\/5853\/revisions"}],"predecessor-version":[{"id":6007,"href":"https:\/\/profi-tutorials.de\/linux\/wp-json\/wp\/v2\/posts\/5853\/revisions\/6007"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/profi-tutorials.de\/linux\/wp-json\/wp\/v2\/media\/5993"}],"wp:attachment":[{"href":"https:\/\/profi-tutorials.de\/linux\/wp-json\/wp\/v2\/media?parent=5853"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/profi-tutorials.de\/linux\/wp-json\/wp\/v2\/categories?post=5853"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/profi-tutorials.de\/linux\/wp-json\/wp\/v2\/tags?post=5853"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}