Hi All,

Checkout this little snippet... There has got to be a better/more elegant solution than this, I've just been staring at it too long to care anymore

Imagine $stamp has the form
YYMMDDHHMMSS so 021109083023 is 8:30:23, 9 Nov 2002

function grab_date($stamp)
{
	$retVal = "";

// Split  $stamp into characters
$p = preg_split('//', $stamp, -1, PREG_SPLIT_NO_EMPTY);

// combine the characters back together
$yr = $p[0].$p[1];
$mn = $p[2].$p[3];
$dy = $p[4].$p[5];
$h = $p[6].$p[7];
$m = $p[8].$p[9];
$s = $p[10].$p[11];

$ts = mktime ($s,$m,$h,$dy,$mn,$yr);
if($ts != -1) {
	$retVal = date ("d F Y (h:m:sa)", $ts);
}
return $retVal;
}

    hi,
    you dont need `split'

    $p='021109083023';
    // rest of your code
    

    PM

      Thanks!

      Also, I noted that I had the parameters to mktime in the wrong order.

      From the Manual:
      int mktime ( int hour, int minute, int second, int month, int day, int year [, int is_dst])

        Write a Reply...