Location: PHPKode > projects > CMS Admin > www/include/date.php
<?php

function printDate($date)
{
	if($date == '0000-00-00')
		$date = date('Y-m-d');

	$dateexplode = explode('-', $date);
	$y = $dateexplode[0];
	$m = $dateexplode[1];
	$d = $dateexplode[2];

	$year = "s_y$y";
	$$year = 'selected="selected"';

	$month = "s_m$m";
	$$month = 'selected="selected"';

	$s_d[$d] = 'selected="selected"'; 

	echo <<< END
<li>
<label>Date</label>
<select name="year">
	<option value="2006" $s_y2006>2006</option>
	<option value="2007" $s_y2007>2007</option>
	<option value="2008" $s_y2008>2008</option>
	<option value="2009" $s_y2009>2009</option>
	<option value="2010" $s_y2010>2010</option>
</select><select name="month">
	<option value="1" $s_m01>January</option>
	<option value="2" $s_m02>February</option>
	<option value="3" $s_m03>March</option>
	<option value="4" $s_m04>April</option>
	<option value="5" $s_m05>May</option>
	<option value="6" $s_m06>June</option>
	<option value="7" $s_m07>July</option>
	<option value="8" $s_m08>August</option>
	<option value="9" $s_m09>September</option>
	<option value="10" $s_m10>October</option>
	<option value="11" $s_m11>November</option>
	<option value="12" $s_m12>December</option>
</select><select name="day">
END;

	for($x=1; $x<=31; $x++)
		echo '<option value="'.$x.'" '.$s_d[$x].'>'.$x . "</option>\n";
	echo <<< END
</select>
END;

}

function formatDate($y, $m, $d)
{
	return $y.'-'.str_pad($m,2,'0', STR_PAD_LEFT).'-'.str_pad($d,2,'0', STR_PAD_LEFT);

}

function showdate($date)
{
	$months = array('January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December');

	$dateexplode = explode('-', $date);
	$y = $dateexplode[0];
	$m = $dateexplode[1];
	$d = $dateexplode[2];

	return $y . ' ' . $months[$m - 1] . ' ' . $d;
}

?>
Return current item: CMS Admin