{"id":889,"date":"2015-01-13T08:36:00","date_gmt":"2015-01-13T08:36:00","guid":{"rendered":"http:\/\/www.masterlevel.de\/blog\/?p=889"},"modified":"2015-02-22T11:24:06","modified_gmt":"2015-02-22T11:24:06","slug":"php-datum-plus-eine-woche","status":"publish","type":"post","link":"https:\/\/www.masterlevel.de\/blog\/php-datum-plus-eine-woche\/","title":{"rendered":"php datum + x tage und andere Beispiele f\u00fcr php\/mySQL"},"content":{"rendered":"<p>Ein paar Beispiele f\u00fcr mySQL:<\/p>\n<pre class=\"brush: php; title: ; notranslate\" title=\"\">\r\n\/\/beliebiges datum\r\n$str = &quot;SELECT * FROM tabelle WHERE DATE_FORMAT(datumsfeld, '%d.%m.%Y') = '17.03.2005'&quot;;\r\n\r\n\/\/gestern\r\n$str = &quot;SELECT * FROM tabelle WHERE DATE_FORMAT(datumsfeld, '%d.%m.%Y') = '&quot;.(date('Y.m.d', time() - 86400)).&quot;'&quot;;\r\n\r\n\/\/letzte 7 tage\r\n$sql = &quot;SELECT * FROM tabelle WHERE datumsfeld BETWEEN SUBDATE(NOW(),INTERVAL 8 DAY) AND SUBDATE(NOW(),INTERVAL 1 DAY)&quot;;\r\n<\/pre>\n<p>Das Datum von heute + einer Woche usw.:<\/p>\n<pre class=\"brush: php; title: ; notranslate\" title=\"\">\r\n&lt;?php\r\n\r\necho date(&quot;d.m.Y&quot;,strtotime(&quot;+1 week&quot;));\r\n\r\necho date(&quot;d.m.Y&quot;,strtotime(&quot;+1 week 4 days 1 hours 40 seconds&quot;));\r\n\r\n?&gt;\r\n<\/pre>\n<p>Von einem bestimmten Datum ausgehend:<\/p>\n<pre class=\"brush: php; title: ; notranslate\" title=\"\">\r\n$dateA = strtotime('+2 months', strtotime('2000-03-22'));\r\n$dateB = strtotime('+1 week', strtotime('2000-03-22'));\r\n$dateC = strtotime('+4 days', strtotime('2000-03-22'));\r\necho date('d.m.Y', $dateA) . '&lt;br&gt;';\r\necho date('d.m.Y', $dateB) . '&lt;br&gt;';\r\necho date('d.m.Y', $dateC) . '&lt;br&gt;';\r\n<\/pre>\n<p>alles andere <a href=\"http:\/\/php.net\/mktime\" target=\"_blank\">http:\/\/php.net\/mktime<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Ein paar Beispiele f\u00fcr mySQL: \/\/beliebiges datum $str = &quot;SELECT * FROM tabelle WHERE DATE_FORMAT(datumsfeld, &#8218;%d.%m.%Y&#8216;) = &#8218;17.03.2005&#8216;&quot;; \/\/gestern $str = &quot;SELECT * FROM tabelle WHERE DATE_FORMAT(datumsfeld, &#8218;%d.%m.%Y&#8216;) = &#8218;&quot;.(date(&#8218;Y.m.d&#8216;, time() &#8211; 86400)).&quot;&#8217;&quot;; \/\/letzte 7 tage $sql = &quot;SELECT * FROM tabelle WHERE datumsfeld BETWEEN SUBDATE(NOW(),INTERVAL 8 DAY) AND SUBDATE(NOW(),INTERVAL 1 DAY)&quot;; Das Datum von &hellip;<\/p>\n<p class=\"read-more\"><a href=\"https:\/\/www.masterlevel.de\/blog\/php-datum-plus-eine-woche\/\">Read more &raquo;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[93,94],"tags":[],"class_list":["post-889","post","type-post","status-publish","format-standard","hentry","category-php","category-snippets"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>php datum + x tage und andere Beispiele f\u00fcr php\/mySQL - masterlevel<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.masterlevel.de\/blog\/php-datum-plus-eine-woche\/\" \/>\n<meta name=\"twitter:label1\" content=\"Verfasst von\" \/>\n\t<meta name=\"twitter:data1\" content=\"J. Adler\" \/>\n\t<meta name=\"twitter:label2\" content=\"Gesch\u00e4tzte Lesezeit\" \/>\n\t<meta name=\"twitter:data2\" content=\"1\u00a0Minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.masterlevel.de\\\/blog\\\/php-datum-plus-eine-woche\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.masterlevel.de\\\/blog\\\/php-datum-plus-eine-woche\\\/\"},\"author\":{\"name\":\"J. Adler\",\"@id\":\"https:\\\/\\\/www.masterlevel.de\\\/blog\\\/#\\\/schema\\\/person\\\/e6868eda89eb09db99b63d9d8dd4b63f\"},\"headline\":\"php datum + x tage und andere Beispiele f\u00fcr php\\\/mySQL\",\"datePublished\":\"2015-01-13T08:36:00+00:00\",\"dateModified\":\"2015-02-22T11:24:06+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.masterlevel.de\\\/blog\\\/php-datum-plus-eine-woche\\\/\"},\"wordCount\":171,\"commentCount\":1,\"articleSection\":[\"PHP\",\"Snippets\"],\"inLanguage\":\"de\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.masterlevel.de\\\/blog\\\/php-datum-plus-eine-woche\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.masterlevel.de\\\/blog\\\/php-datum-plus-eine-woche\\\/\",\"url\":\"https:\\\/\\\/www.masterlevel.de\\\/blog\\\/php-datum-plus-eine-woche\\\/\",\"name\":\"php datum + x tage und andere Beispiele f\u00fcr php\\\/mySQL - masterlevel\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.masterlevel.de\\\/blog\\\/#website\"},\"datePublished\":\"2015-01-13T08:36:00+00:00\",\"dateModified\":\"2015-02-22T11:24:06+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/www.masterlevel.de\\\/blog\\\/#\\\/schema\\\/person\\\/e6868eda89eb09db99b63d9d8dd4b63f\"},\"inLanguage\":\"de\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.masterlevel.de\\\/blog\\\/php-datum-plus-eine-woche\\\/\"]}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.masterlevel.de\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/www.masterlevel.de\\\/blog\\\/\",\"name\":\"masterlevel\",\"description\":\"Manche Sachen vergi\u00dft man, weil man sie nicht oft braucht - deshalb stehen sie hier...\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.masterlevel.de\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"de\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.masterlevel.de\\\/blog\\\/#\\\/schema\\\/person\\\/e6868eda89eb09db99b63d9d8dd4b63f\",\"name\":\"J. Adler\",\"url\":\"https:\\\/\\\/www.masterlevel.de\\\/blog\\\/author\\\/admin\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"php datum + x tage und andere Beispiele f\u00fcr php\/mySQL - masterlevel","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.masterlevel.de\/blog\/php-datum-plus-eine-woche\/","twitter_misc":{"Verfasst von":"J. Adler","Gesch\u00e4tzte Lesezeit":"1\u00a0Minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.masterlevel.de\/blog\/php-datum-plus-eine-woche\/#article","isPartOf":{"@id":"https:\/\/www.masterlevel.de\/blog\/php-datum-plus-eine-woche\/"},"author":{"name":"J. Adler","@id":"https:\/\/www.masterlevel.de\/blog\/#\/schema\/person\/e6868eda89eb09db99b63d9d8dd4b63f"},"headline":"php datum + x tage und andere Beispiele f\u00fcr php\/mySQL","datePublished":"2015-01-13T08:36:00+00:00","dateModified":"2015-02-22T11:24:06+00:00","mainEntityOfPage":{"@id":"https:\/\/www.masterlevel.de\/blog\/php-datum-plus-eine-woche\/"},"wordCount":171,"commentCount":1,"articleSection":["PHP","Snippets"],"inLanguage":"de","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.masterlevel.de\/blog\/php-datum-plus-eine-woche\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.masterlevel.de\/blog\/php-datum-plus-eine-woche\/","url":"https:\/\/www.masterlevel.de\/blog\/php-datum-plus-eine-woche\/","name":"php datum + x tage und andere Beispiele f\u00fcr php\/mySQL - masterlevel","isPartOf":{"@id":"https:\/\/www.masterlevel.de\/blog\/#website"},"datePublished":"2015-01-13T08:36:00+00:00","dateModified":"2015-02-22T11:24:06+00:00","author":{"@id":"https:\/\/www.masterlevel.de\/blog\/#\/schema\/person\/e6868eda89eb09db99b63d9d8dd4b63f"},"inLanguage":"de","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.masterlevel.de\/blog\/php-datum-plus-eine-woche\/"]}]},{"@type":"WebSite","@id":"https:\/\/www.masterlevel.de\/blog\/#website","url":"https:\/\/www.masterlevel.de\/blog\/","name":"masterlevel","description":"Manche Sachen vergi\u00dft man, weil man sie nicht oft braucht - deshalb stehen sie hier...","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.masterlevel.de\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"de"},{"@type":"Person","@id":"https:\/\/www.masterlevel.de\/blog\/#\/schema\/person\/e6868eda89eb09db99b63d9d8dd4b63f","name":"J. Adler","url":"https:\/\/www.masterlevel.de\/blog\/author\/admin\/"}]}},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/www.masterlevel.de\/blog\/wp-json\/wp\/v2\/posts\/889","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.masterlevel.de\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.masterlevel.de\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.masterlevel.de\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.masterlevel.de\/blog\/wp-json\/wp\/v2\/comments?post=889"}],"version-history":[{"count":4,"href":"https:\/\/www.masterlevel.de\/blog\/wp-json\/wp\/v2\/posts\/889\/revisions"}],"predecessor-version":[{"id":936,"href":"https:\/\/www.masterlevel.de\/blog\/wp-json\/wp\/v2\/posts\/889\/revisions\/936"}],"wp:attachment":[{"href":"https:\/\/www.masterlevel.de\/blog\/wp-json\/wp\/v2\/media?parent=889"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.masterlevel.de\/blog\/wp-json\/wp\/v2\/categories?post=889"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.masterlevel.de\/blog\/wp-json\/wp\/v2\/tags?post=889"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}