php date() and mktime() example

Share:
This can be more reliable than simply adding or subtracting the number of seconds in a day or month to a timestamp because of daylight saving time.

 <?php  
 $tomorrow = mktime(0, 0, 0, date("m") , date("d")+1, date("Y"));  
 $lastmonth = mktime(0, 0, 0, date("m")-1, date("d"),  date("Y"));  
 $nextyear = mktime(0, 0, 0, date("m"),  date("d"),  date("Y")+1);  
 ?>  

No comments

'; (function() { var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true; dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js'; (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq); })();

Ads