Last flight date

Hi, im trying to list on the pilots page the last date that a pilot flew, i have been playing with the

<?php echo PilotData::GetFieldValue($pilot->pilotid, ‘*********’); ?> but not sure if that can work. Any sugestions please.

Thanks

     

No worries ill have a look at where the latest pireps get the info from

Right i have a date in there now but its 1969, this is the format i used, have i missed something?

<?php echo date(DATE_FORMAT, $report->submitdate); ?>

Instead of DATE_FORMAT try ‘m Y’ just to test

Changed to

<?php echo date(d.m.Y, $report->submitdate); ?>

Still get 31 12 1969, will try logging another flight see what happens

What are you using to get the last PIREP?

<?php echo date(‘d.m.Y’, $report->submitdate); ?>

Should be in quotes.

Still showing up as 31.12.1969, that’s for all pilots

How are you getting the last pirep? What function/which template

this is the line im using in the pilots_list.tpl,

<?php echo date(‘d.M.Y’, $report->submitdate); ?>

Where are you getting $report from, are you getting their latest PIREP?

$report has to be assigned to something,  for instance:

http://phpvms.net/docs/api/phpvms/PIREPData.html#GetLastReports

so

<?php

$report = PIREPData::GetLastReports($pilot->pilotid, 1);

echo date(‘d.M.Y’, $report->submitdate);

?>

Still cant get to work

I will have another play later on.

try this

<?php
$report = PIREPData::GetLastReports($pilot->pilotid, 1);
echo date('d.M.Y', strtotime($report->submitdate));
?>

But since you’re using the beta, you can do now:

<?php
echo date('d.M.Y', strtotime($pilot->lastpirep));
?>

I thought it made sense to just automatically log that.

<?php
$report = PIREPData::GetLastReports($pilot->pilotid, 1);
echo date('d.M.Y', strtotime($report->submitdate));
?>

That works Thank you

Cool. When you update, use the 2nd one I posted, saves a query:)

Tried that one first, it didn’t seem to work.

Yeah, it’s not populated right now with the latest pirep. I should perhaps have that in an update