Dates and Times: Formatting
	
	
	";
		
		function strip_zeros_from_date($marked_string="") {
			// remove the marked zeros
			$no_zeros = str_replace('*0', '', $marked_string);
			// then remove any remaining marks
			$cleaned_string = str_replace('*', '', $no_zeros);
			return $no_zeros;
		}
		
		echo strip_zeros_from_date(strftime("The date today is *%m/*%d/%y", $timestamp));
		
		echo "
"; $dt = time(); $mysql_datetime = strftime("%Y-%m-%d %H:%M:%S", $dt); echo $mysql_datetime; ?>

The date today is 04/20/12
The date today is 4/*20/12
2012-04-20 06:20:12

'개발관련 > PHP' 카테고리의 다른 글

[PHP]File Access  (0) 2012.04.20
[PHP]Date Time Unix  (0) 2012.04.20
[PHP]Constructors  (0) 2012.04.20
[PHP]Comparison  (0) 2012.04.20
[PHP]Cloning  (0) 2012.04.20
Posted by 파노카페
: