{"id":2233,"date":"2012-04-12T07:07:29","date_gmt":"2012-04-12T07:07:29","guid":{"rendered":"http:\/\/phpcodez.com\/?p=2233"},"modified":"2012-04-12T07:07:29","modified_gmt":"2012-04-12T07:07:29","slug":"date_add","status":"publish","type":"post","link":"http:\/\/phpcodez.com\/date_add\/","title":{"rendered":"date_add"},"content":{"rendered":"<div>\n<div>Its an alias of <a href=\"http:\/\/phpcodez.com\/datetime-add\">DateTime::add()<\/a><\/div>\n<div>We can add number of of days, months, years, hours and seconds with \u00a0a DateTime object.<\/div>\n<div>\n<p><strong>Example<\/strong><\/p>\n<p>&lt;?php<\/p>\n<p>$date = new DateTime(&#8220;24-May-2011 20:15:22&#8221;);<br \/>\necho $date-&gt;format(&#8220;d-m-Y H:i:s&#8221;).'&lt;br \/&gt;&#8217;;<\/p>\n<p>date_add($date, new DateInterval(&#8220;P1Y&#8221;));<br \/>\necho &#8216;&lt;br \/&gt;&#8217;.$date-&gt;format(&#8220;d-m-Y&#8221;).&#8217; : I Year&#8217;;<\/p>\n<p>?&gt;<\/p>\n<p><strong>Output<\/strong><\/p>\n<p>24-05-2011 20:15:22<\/p>\n<p>24-05-2012 : I Year<\/p>\n<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Its an alias of DateTime::add() We can add number of of days, months, years, hours and seconds with \u00a0a DateTime object. Example &lt;?php $date = new DateTime(&#8220;24-May-2011 20:15:22&#8221;); echo $date-&gt;format(&#8220;d-m-Y H:i:s&#8221;).'&lt;br \/&gt;&#8217;; date_add($date, new DateInterval(&#8220;P1Y&#8221;)); echo &#8216;&lt;br \/&gt;&#8217;.$date-&gt;format(&#8220;d-m-Y&#8221;).&#8217; : I Year&#8217;; ?&gt; Output 24-05-2011 20:15:22 24-05-2012 : I Year<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[25],"tags":[147,213,370],"class_list":["post-2233","post","type-post","status-publish","format-standard","hentry","category-php","tag-date","tag-functions","tag-php"],"_links":{"self":[{"href":"http:\/\/phpcodez.com\/wp-json\/wp\/v2\/posts\/2233","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/phpcodez.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/phpcodez.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/phpcodez.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/phpcodez.com\/wp-json\/wp\/v2\/comments?post=2233"}],"version-history":[{"count":0,"href":"http:\/\/phpcodez.com\/wp-json\/wp\/v2\/posts\/2233\/revisions"}],"wp:attachment":[{"href":"http:\/\/phpcodez.com\/wp-json\/wp\/v2\/media?parent=2233"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/phpcodez.com\/wp-json\/wp\/v2\/categories?post=2233"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/phpcodez.com\/wp-json\/wp\/v2\/tags?post=2233"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}