string getMidString(string $string, int $startindex, int $length)

Returns a substring of $string. The substring begins at the 0 based index $startindex and is $length characters long.

If $length is -1, then the returned string begins at $startindex and ends at the last character of $string.

Example:

$date='2010-08-16T08:30-06:00';
$daypart=getMidString($date,0,10); // get '2010-08-16' part