Good evening,
I have the following .php file to print the contents of a .json file from an external API. The reason why I don't directly link the .json file to bootstrap-table.css on my site is because there is not a HTTPS version of the API, which I need to keep my site secure.
One of the JSON objects in this scenario is logon, which is the login time as unparsed text string. For example, 20120722091954.
I was wondering if there was a way of parsing the string into a date so that I can display it in my Bootstrap table, the code for which is:
<table data-toggle="table" data-url="https://vatsim.theobearman.com/eud2.php" data-cache="false" data-show-refresh="true" data-query-params="queryParams" data-pagination="true" data-search="true" data-page-list="5, 10, 25, 50, 100, All" data-height="400" data-sort-name="callsign" data-sort-order="asc" date-width="100%">
<thead>
<tr>
<th data-field="callsign" data-halign="center" data-align="center" data-sortable="true">Callsign</th>
<th data-field="name" data-halign="center" data-align="center" data-sortable="true">Name</th>
<th data-field="aircraft" data-halign="center" data-align="center" data-sortable="true">Aircraft</th>
<th data-field="origin" data-halign="center" data-align="center" data-sortable="true">Departure Airport</th>
<th data-field="destination" data-halign="center" data-align="center" data-sortable="true">Arrival Airport</th>
<th data-field="flight_type" data-halign="center" data-align="center" data-sortable="true">Type</th>
<th data-field="altitude" data-halign="center" data-align="center" data-sortable="true">Altitude</th>
<th data-field="groundspeed" data-halign="center" data-align="center" data-sortable="true">Groundspeed</th>
<th data-field="transponder" data-halign="center" data-align="center" data-sortable="true">Squawk</th>
<th data-field="logon" data-halign="center" data-align="center" data-sortable="true">Logon Time</th>
</tr>
</thead>
</table>`
The contents of the .php file is:
<?php
print file_get_contents("http://api.vateud.net/online/pilots/eg.json");
?
Thanks in advance!
Edit: I see that I can achieve this with:
$myDateTime = DateTime::createFromFormat('Y-m-d', $dateString);
$newDateString = $myDateTime->format('m/d/Y');
However I am confused as to where to put this php code and how to make sure it is pulling the logon string from the pulled json file.