Monthly Archives: September 2009

Articles I’ve Written on IBM i (iSeries) Technology Subjects

I’ve written a few articles in recent years that have been published by MC Press Online, relating to IBM i topics. If you don’t know what the IBM i is (or an AS/400, iSeries or System i), you can stop reading! Here are two lists of links to those articles. The first list is general education. The second is product-specific, related to products marketed by my company. (Articles are ordered by most recent first)

Educational Articles

Product-Specific Articles

How To Format a MySQL Date For Output in PHP

The following PHP code parses the date portion out of a MySQL date column and lets you format it according to the formatting rules of the PHP date function.

// Parse date portion of a date field and format it according to the date() function.
// Second parm is optional. 
function FmtDateTime($dt, $fmt = "F d, Y")
{
	$arr = explode("-", substr($dt, 0, 10)); 
	//	$fmt of "m/d/Y" prints date in mm/dd/yyyy format. 
	//  $fmt of "F d, Y" prints date in Spelled out month day, YYYY format
	
	echo date($fmt, mktime(0,0,0, $arr[1], $arr[2], $arr[0])); 
}

To use it, you can do something like this:

<?php
   FmtDateTime($scdDate, "l d F, Y" ); ?> 

(This prints 2009-09-15 as “Tuesday 15 September, 2009”).

If you omit the second parameter on the function call, the date will print like this:
“September 15, 2009”