The last PIREP date is stored in the pilot's table, in the 'lastpirep' field, as a datetime, so you could do:
<?php
$pilots = PilotData::GetAllPilots();
foreach($pilots as $pilot)
{
echo "{$pilot->firstname} {$pilot->lastname} - {$pilot->lastpirep}<br />";
}
When using double quotes in a string, it's good practice to encapsulate variables in { }
You can check if it's null (this is the default value, it's only updated when there's a PIREP):
if($pilot->lastpirep == '0000-00-00 00:00:00')
{
echo 'No PIREP';
}
else
{
// What David suggested:
echo date('m-d-Y', strtotime($pirep->lastpirep));
}
This will be the most reliable way.
Also, not sure if you knew, if this is outside of phpVMS, you have to:
<?php
include '/path/to/core/codon.config.php';
Then anything with the API should work.