PHP has a function date where you can specify different ways on how to display the date. How do you generate current date and display only month and date like ‘September 2010′. Here is a simple php howto,
|
1 2 3 4 5 6 |
<div>function curDate() {</div>
<div id="_mcePaste">return date("Y-m-d",mktime(date("h")+8, date("i"), date("s"), date("m") , date("d"), date("Y")));</div>
<div id="_mcePaste">}</div>
<div>$now = substr(curDate(),0,7);</div>
<div>echo date("F Y", strtotime($now));</div>
<div>?></div> |
The code above will simply output September 2010, a simple code that will surely help you especially when coding PHP from scratch.


0 Comments until now.
Comment!