Jump to content

Help With time


cdawg

Recommended Posts

hello all,

i have been searching for hours with no luck....can anybody tell me how i can change the flighttime_stamp from when a pirep is being submitted into the data base instead of reading as time it just reads as numbers....for example when its inserted into the database it reads 5:00....i would like for it to read just 5 so i need to know what file i need to change so that when its going into the database it just reads the number and what in the file do i need to change? thanks so much

Link to comment
Share on other sites

  • Administrators

The database table is set up as a time field, so even if you submit a single number it is going to format it to the 00:00:00 format. The data is submitted in the SubmitPIREP function in the PIREPS.php module controller. You are starting to hack into core files that will be overwritten if you ever update though.

I am assuming that you are trying to display only a number of hours and no minutes or seconds so possibly a better solution would be to just break up the data using an explode statement and then just displaying the hours piece.

Something like;

$hours = explode(':', $hoursvariable);
echo $hours[0];

Link to comment
Share on other sites

  • Administrators

Most desireable would be to do it in your controller and load the data into a new variable set and pass that to the template, but you can do it right in the template where you want it to display as well. It is not an actual database call at that point so the php functions being in the template is not a big deal at that point in my opinion.

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...