Jump to content

ETA


mseiwald

Recommended Posts

Yeah, sorry yesterday was a long day. I have a working code below, but it doesn't work in phpVMS as the only way I know of getting the remaining time is to use the API call <%=flight.timeremaining%>, which won't parse within PHP code (or at least not to my knowledge). So I haven't answered your question, but you might be able to work on it using this (you can manipulate the time by changing the hours with strftime:



<?php

$time = strtotime("now +07 hours");

print gmdate('H:i T', $time);

?>

Link to comment
Share on other sites

You're welcome. Do you have it working yet? I've been working on it myself, but my lack of knowledge surrounding the way phpVMS works is showing.

This is my current code, just FYI. It's not working, but it explodes the HH:MM, allowing you to add the hours and minutes to the API call in theory. What I really need to know is why the API call won't work. I can echo it in single quotes, so it should work if I replace 12:00 with it, but it doesn't--very frustrating.


$returnedString = '12:00';
$returnedTime = explode(':', $returnedString);

//$time = strtotime("now +{$returnedTime[0]} hours, +{$returnedTime[1]} minutes");
// Or this
$time = strtotime('now +' . $returnedTime[0] . ' hours, +' . $returnedTime[1] . ' minutes');

print gmdate('H:i T', $time);

Link to comment
Share on other sites

no i havent got it working...I also searched everywhere and tried some things but it`s always the same 00:00 or nothing at all :( for now i`ve set it back to time remaining on the site.

i would have loved to get this working and show the ETA on my site but it`s almost impossible for me to find out why it doesn`t as i never ever coded anything before ;)

kind regards

Manuel

Link to comment
Share on other sites

  • 2 months later...
  • 7 months later...

Hi Paul,

i just found this old topic and tried again to get this to work and surprisingly the code you have posted above now works perfectly on my site..... don`t ask me why.

I have this:

<?php
$returnedString = $flight->timeremaining;
$returnedTime = explode(':', $returnedString);
$time = strtotime('now +' . $returnedTime[0] . ' hours, +' . $returnedTime[1] . ' minutes' );
print gmdate('H:i T', $time);
?>  

and it works great ;)

so thank you again for that

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...