chocopi Posted June 2, 2007 Share Posted June 2, 2007 good one down one to go, can you post the whole file please Quote Link to comment https://forums.phpfreaks.com/topic/53993-solved-time-formatting/page/2/#findComment-267027 Share on other sites More sharing options...
iLLeLogicaL Posted June 2, 2007 Share Posted June 2, 2007 Post the whole part starting from where you retrieve the date & time. That should make it a lot easier for the lot of us Quote Link to comment https://forums.phpfreaks.com/topic/53993-solved-time-formatting/page/2/#findComment-267034 Share on other sites More sharing options...
snowdog Posted June 2, 2007 Share Posted June 2, 2007 $time = "20:18:05"; // make this your pull from the database.  $display_time = date("h:i A", strtotime($time));  will display as  08:18 PM  Snowdog Quote Link to comment https://forums.phpfreaks.com/topic/53993-solved-time-formatting/page/2/#findComment-267035 Share on other sites More sharing options...
kemper Posted June 2, 2007 Author Share Posted June 2, 2007 <?php require_once "maincore.php"; require_once "subheader.php"; require_once "side_left.php"; include LOCALE.LOCALESET."sched.php"; //if (!checkrights("FR")) fallback("../index.php"); //int mktime ( [int $hour [, int $minute [, int $second [, int $month [, int $day [, int $year [, int $is_dst]]]]]]] ) $time = split(":", $data['time']); $new_time = mktime($time[0], $time[1], $time[2], 1, 1, 1999); if (isset($_POST['edit_sched'])) { $time = stripinput($_POST['time']); $home_field = stripinput($_POST['home_field']); $field_no = stripinput($_POST['field_no']); $result = dbquery("UPDATE f2007_scheduling SET sched_user='".$userdata['user_id']."', time='$time', home_field='$home_field', field_no='$field_no' WHERE id='$id' "); //$result = dbquery("UPDATE ".$db_prefix."faq_cats SET faq_cat_name='$faq_cat_name' WHERE faq_cat_id='$faq_cat_id'"); } if ($step == "edit"){ //$data = dbarray(dbquery( // "SELECT ter.*, user_id,user_name FROM f2007_scheduling ter // LEFT JOIN ".$db_prefix."users tusr ON ter.sched_user=tusr.user_id // WHERE id='$id'" // )); $data = dbarray(dbquery("SELECT * FROM f2007_scheduling WHERE id='$id'")); opentable ("Fall Schedules"); print ("$data['time']\n"); closetable (); } opentable ($locale['sched001']); $sql = dbquery( "SELECT ter.*, user_id,user_name FROM f2007_scheduling ter LEFT JOIN ".$db_prefix."users tusr ON ter.sched_user=tusr.user_id ORDER BY date ASC" ); if (dbrows($sql)) { $i = 0; echo "<table width='100%' cellpadding='0' cellspacing='1' class='tbl-border'> <tr> <td class='tbl2' width='55%'><b>Schedules <font size='1'>(Date - Age Division - Home vs. Visitors)</font></b>:</td> <td align='center' width='15%' class='tbl2'><b>Time/Notes</b>:</td> <td align='center' width='15%' class='tbl2'><b>Field</b>:</td> <td align='center' width='15%' class='tbl2'><b>Options:</b></td> </tr>\n"; while ($data = dbarray($sql)) { $i % 2 == 0 ? $tclass="tbl1" : $tclass="tbl2"; echo "<tr> <td class='$tclass' width='55%'><font size='1'><font color='#0000FF'>".$data['date']." - </font>".$data['age']." ".$data['division']." - ".$data['home_team']." vs. ".$data['visiting_team']."</font></font></td> <td align='center' class='$tclass' width='15%'><font size='1'> <span style='background-color: #FFFF00'>".$data['notes']."</span></font></td> <td align='center' class='$tclass' width='15%'><font size='1'>".$data['home_field']." ".$data['field_no']."</font></td> <td align='center' class='$tclass' width='15%'><a href='".FUSION_SELF."?step=edit&id=".$data['id']."'>".$locale['sched002']."</a></td> </tr>\n"; } echo "</table>\n"; } else { echo "<center><br>\n".$locale['sched141']."<br><br>\n</center>\n"; } closetable(); echo "</td>\n"; require_once BASEDIR."footer.php"; ?> Â ^ Is with print ("$data['time'] Â My original code is: <?php require_once "maincore.php"; require_once "subheader.php"; require_once "side_left.php"; include LOCALE.LOCALESET."sched.php"; //if (!checkrights("FR")) fallback("../index.php"); //int mktime ( [int $hour [, int $minute [, int $second [, int $month [, int $day [, int $year [, int $is_dst]]]]]]] ) $time = split(":", $data['time']); $new_time = mktime($time[0], $time[1], $time[2], 1, 1, 1999); if (isset($_POST['edit_sched'])) { $time = stripinput($_POST['time']); $home_field = stripinput($_POST['home_field']); $field_no = stripinput($_POST['field_no']); $result = dbquery("UPDATE f2007_scheduling SET sched_user='".$userdata['user_id']."', time='$time', home_field='$home_field', field_no='$field_no' WHERE id='$id' "); //$result = dbquery("UPDATE ".$db_prefix."faq_cats SET faq_cat_name='$faq_cat_name' WHERE faq_cat_id='$faq_cat_id'"); } if ($step == "edit"){ //$data = dbarray(dbquery( // "SELECT ter.*, user_id,user_name FROM f2007_scheduling ter // LEFT JOIN ".$db_prefix."users tusr ON ter.sched_user=tusr.user_id // WHERE id='$id'" // )); $data = dbarray(dbquery("SELECT * FROM f2007_scheduling WHERE id='$id'")); opentable ($locale['sched001']); echo "<form name='reportform' method='post' action='".FUSION_SELF."?id=$id'> ".$locale['sched120']." <table align='center' cellspacing='5' cellpadding='5' class='tbl' width='375'> <tr> <td width='124' valign='top'> <p style='margin-top: 0; margin-bottom: 0'><b>Age:</b></td> <td width='216' valign='top'> <p style='margin-top: 0; margin-bottom: 0'>".$data['age']."</td> </tr> <tr> <td valign='top' width='124'> <p style='margin-top: 0; margin-bottom: 0'><b>Division:</b></td> <td valign='top' width='216'> <p style='margin-top: 0; margin-bottom: 0'>".$data['division']."</p> </td> </tr> <tr> <td width='124' valign='top'> <p style='margin-top: 0; margin-bottom: 0'><b>Game ID:</b></td> <td width='216' valign='top'> <p style='margin-top: 0; margin-bottom: 0'>".$data['id']."</td> </tr> <tr> <td width='124' valign='top'> <p style='margin-top: 0; margin-bottom: 0'><b>Date:</b></td> <td width=216' valign='top'> <p style='margin-top: 0; margin-bottom: 0'>".$data['date']=date("D, F j, Y",strtotime($date['date']))."</td> </tr> <tr> <td width='124' valign='top'> <p style='margin-top: 0; margin-bottom: 0'><b>Time/Notes:</b></td> <td width='216' valign='top'> <p style='margin-top: 0; margin-bottom: 0'> <span style='background-color: #FFFF00'>".$data['notes']."</span></td> </tr> <tr> <td valign='top' width='124'> <p style='margin-top: 0; margin-bottom: 0'><b>Time</b></td> <td valign='top' width='216'> <p style='margin-top: 0; margin-bottom: 0'>".date("h:i a", $new_time)."</td> </tr> <tr> <td width='124' valign='top'> <p style='margin-top: 0; margin-bottom: 0'><b>Match-up:</b></td> <td width='216' valign='top'> <p style='margin-top: 0; margin-bottom: 0'>".$data['home_team']."</p> <p style='margin-top: 0; margin-bottom: 0'><font color='#0000FF'>vs.</font> ".$data['visiting_team']."</td> </tr> <tr> <td width='124' valign='top'> <p style='margin-top: 0; margin-bottom: 0'><b>Field:</b></td> <td width='216' valign='top'> <p style='margin-top: 0; margin-bottom: 0'><input type='text' name='home_field' value='".$data['home_field']."' class='textbox' style='width:150px;'></td> </tr> <tr> <td width='124' valign='top'> <p style='margin-top: 0; margin-bottom: 0'><b>Field # or Name:</b></td> <td width='216' valign='top'> <p style='margin-top: 0; margin-bottom: 0'><input type='text' name='field_no' value='".$data['field_no']."' class='textbox' style='width:100px;'></td> </tr> <tr> <td align='center' colspan='2'> <input type='submit' name='edit_sched' value='".$locale['sched135']."' class='button'></td> </tr> </table> </form>\n"; closetable (); } opentable ($locale['sched001']); $sql = dbquery( "SELECT ter.*, user_id,user_name FROM f2007_scheduling ter LEFT JOIN ".$db_prefix."users tusr ON ter.sched_user=tusr.user_id ORDER BY date ASC" ); if (dbrows($sql)) { $i = 0; echo "<table width='100%' cellpadding='0' cellspacing='1' class='tbl-border'> <tr> <td class='tbl2' width='55%'><b>Schedules <font size='1'>(Date - Age Division - Home vs. Visitors)</font></b>:</td> <td align='center' width='15%' class='tbl2'><b>Time/Notes</b>:</td> <td align='center' width='15%' class='tbl2'><b>Field</b>:</td> <td align='center' width='15%' class='tbl2'><b>Options:</b></td> </tr>\n"; while ($data = dbarray($sql)) { $i % 2 == 0 ? $tclass="tbl1" : $tclass="tbl2"; echo "<tr> <td class='$tclass' width='55%'><font size='1'><font color='#0000FF'>".$data['date']." - </font>".$data['age']." ".$data['division']." - ".$data['home_team']." vs. ".$data['visiting_team']."</font></font></td> <td align='center' class='$tclass' width='15%'><font size='1'> <span style='background-color: #FFFF00'>".$data['notes']."</span></font></td> <td align='center' class='$tclass' width='15%'><font size='1'>".$data['home_field']." ".$data['field_no']."</font></td> <td align='center' class='$tclass' width='15%'><a href='".FUSION_SELF."?step=edit&id=".$data['id']."'>".$locale['sched002']."</a></td> </tr>\n"; } echo "</table>\n"; } else { echo "<center><br>\n".$locale['sched141']."<br><br>\n</center>\n"; } closetable(); echo "</td>\n"; require_once BASEDIR."footer.php"; ?> Quote Link to comment https://forums.phpfreaks.com/topic/53993-solved-time-formatting/page/2/#findComment-267051 Share on other sites More sharing options...
per1os Posted June 2, 2007 Share Posted June 2, 2007 <?php header("Content-type:text/xml"); $not_completed = "tesT"; echo '<?xml version="1.0" encoding="utf-8"?> <graph> <general_settings bg_color="FFFFFF" /> <header text="Jobs for Expansion Installation - Integration" font="Verdana" color="000000" size="18" /> <subheader text="" font="Verdana" color="000000" size="15" /> <legend font="Verdana" font_color="000000" font_size="11" bgcolor="FFFFFF" alternate_bg_color="FFF9E1" border_color="BFBFBF" /> <legend_popup font="Verdana" bgcolor="FFFFE3" font_size="10" /> <pie_chart radius="100" height="35" angle_slope="45" alpha_sides="60" alpha_lines="20" /> <data name="Completed" value="' . $not_completed . '" color="FF0000" /> <data name="Not Completed" value="'.$completed.'" color="333333" /> </graph>'; ?> <?php require_once "maincore.php"; require_once "subheader.php"; require_once "side_left.php"; include LOCALE.LOCALESET."sched.php"; //if (!checkrights("FR")) fallback("../index.php"); //int mktime ( [int $hour [, int $minute [, int $second [, int $month [, int $day [, int $year [, int $is_dst]]]]]]] ) $time = split(":", $data['time']); $new_time = mktime($time[0], $time[1], $time[2], 1, 1, 1999); if (isset($_POST['edit_sched'])) { $time = stripinput($_POST['time']); $home_field = stripinput($_POST['home_field']); $field_no = stripinput($_POST['field_no']); $result = dbquery("UPDATE f2007_scheduling SET sched_user='".$userdata['user_id']."', time='$time', home_field='$home_field', field_no='$field_no' WHERE id='$id' "); //$result = dbquery("UPDATE ".$db_prefix."faq_cats SET faq_cat_name='$faq_cat_name' WHERE faq_cat_id='$faq_cat_id'"); } if ($step == "edit"){ //$data = dbarray(dbquery( // "SELECT ter.*, user_id,user_name FROM f2007_scheduling ter // LEFT JOIN ".$db_prefix."users tusr ON ter.sched_user=tusr.user_id // WHERE id='$id'" // )); $data = dbarray(dbquery("SELECT * FROM f2007_scheduling WHERE id='$id'")); $time = split(":", $time); $new_time = mktime($time[0], $time[1], $time[2], 1, 1, 1999); opentable ($locale['sched001']); echo "<form name='reportform' method='post' action='".FUSION_SELF."?id=$id'> ".$locale['sched120']." <table align='center' cellspacing='5' cellpadding='5' class='tbl' width='375'> <tr> <td width='124' valign='top'> <p style='margin-top: 0; margin-bottom: 0'><b>Age:</b></td> <td width='216' valign='top'> <p style='margin-top: 0; margin-bottom: 0'>".$data['age']."</td> </tr> <tr> <td valign='top' width='124'> <p style='margin-top: 0; margin-bottom: 0'><b>Division:</b></td> <td valign='top' width='216'> <p style='margin-top: 0; margin-bottom: 0'>".$data['division']."</p> </td> </tr> <tr> <td width='124' valign='top'> <p style='margin-top: 0; margin-bottom: 0'><b>Game ID:</b></td> <td width='216' valign='top'> <p style='margin-top: 0; margin-bottom: 0'>".$data['id']."</td> </tr> <tr> <td width='124' valign='top'> <p style='margin-top: 0; margin-bottom: 0'><b>Date:</b></td> <td width=216' valign='top'> <p style='margin-top: 0; margin-bottom: 0'>".$data['date']=date("D, F j, Y",strtotime($date['date']))."</td> </tr> <tr> <td width='124' valign='top'> <p style='margin-top: 0; margin-bottom: 0'><b>Time/Notes:</b></td> <td width='216' valign='top'> <p style='margin-top: 0; margin-bottom: 0'> <span style='background-color: #FFFF00'>".$data['notes']."</span></td> </tr> <tr> <td valign='top' width='124'> <p style='margin-top: 0; margin-bottom: 0'><b>Time</b></td> <td valign='top' width='216'> <p style='margin-top: 0; margin-bottom: 0'>".date("h:i a", $new_time)."</td> </tr> <tr> <td width='124' valign='top'> <p style='margin-top: 0; margin-bottom: 0'><b>Match-up:</b></td> <td width='216' valign='top'> <p style='margin-top: 0; margin-bottom: 0'>".$data['home_team']."</p> <p style='margin-top: 0; margin-bottom: 0'><font color='#0000FF'>vs.</font> ".$data['visiting_team']."</td> </tr> <tr> <td width='124' valign='top'> <p style='margin-top: 0; margin-bottom: 0'><b>Field:</b></td> <td width='216' valign='top'> <p style='margin-top: 0; margin-bottom: 0'><input type='text' name='home_field' value='".$data['home_field']."' class='textbox' style='width:150px;'></td> </tr> <tr> <td width='124' valign='top'> <p style='margin-top: 0; margin-bottom: 0'><b>Field # or Name:</b></td> <td width='216' valign='top'> <p style='margin-top: 0; margin-bottom: 0'><input type='text' name='field_no' value='".$data['field_no']."' class='textbox' style='width:100px;'></td> </tr> <tr> <td align='center' colspan='2'> <input type='submit' name='edit_sched' value='".$locale['sched135']."' class='button'></td> </tr> </table> </form>\n"; closetable (); } opentable ($locale['sched001']); $sql = dbquery( "SELECT ter.*, user_id,user_name FROM f2007_scheduling ter LEFT JOIN ".$db_prefix."users tusr ON ter.sched_user=tusr.user_id ORDER BY date ASC" ); if (dbrows($sql)) { $i = 0; echo "<table width='100%' cellpadding='0' cellspacing='1' class='tbl-border'> <tr> <td class='tbl2' width='55%'><b>Schedules <font size='1'>(Date - Age Division - Home vs. Visitors)</font></b>:</td> <td align='center' width='15%' class='tbl2'><b>Time/Notes</b>:</td> <td align='center' width='15%' class='tbl2'><b>Field</b>:</td> <td align='center' width='15%' class='tbl2'><b>Options:</b></td> </tr>\n"; while ($data = dbarray($sql)) { $i % 2 == 0 ? $tclass="tbl1" : $tclass="tbl2"; echo "<tr> <td class='$tclass' width='55%'><font size='1'><font color='#0000FF'>".$data['date']." - </font>".$data['age']." ".$data['division']." - ".$data['home_team']." vs. ".$data['visiting_team']."</font></font></td> <td align='center' class='$tclass' width='15%'><font size='1'> <span style='background-color: #FFFF00'>".$data['notes']."</span></font></td> <td align='center' class='$tclass' width='15%'><font size='1'>".$data['home_field']." ".$data['field_no']."</font></td> <td align='center' class='$tclass' width='15%'><a href='".FUSION_SELF."?step=edit&id=".$data['id']."'>".$locale['sched002']."</a></td> </tr>\n"; } echo "</table>\n"; } else { echo "<center><br>\n".$locale['sched141']."<br><br>\n</center>\n"; } closetable(); echo "</td>\n"; require_once BASEDIR."footer.php"; ?> Â Â Should work. Quote Link to comment https://forums.phpfreaks.com/topic/53993-solved-time-formatting/page/2/#findComment-267053 Share on other sites More sharing options...
kemper Posted June 2, 2007 Author Share Posted June 2, 2007 Thats what gives me 12:00 am. Â if it matters, my table is set up as: CREATE TABLE `f2007_scheduling` ( `club_id` smallint(3) NOT NULL default '0', `status` text NOT NULL, `age` text NOT NULL, `division` text NOT NULL, `id` text NOT NULL, `date` date NOT NULL default '0000-00-00', `notes` text NOT NULL, `time` time NOT NULL default '00:00:00', `home` text NOT NULL, `h_score` text NOT NULL, `home_team` text NOT NULL, `hteam_no` text NOT NULL, `home_field` text NOT NULL, `field_no` text NOT NULL, `visitors` text NOT NULL, `v_score` text NOT NULL, `visiting_team` text NOT NULL, `vteam_no` text NOT NULL, `visitor_field` text NOT NULL, `sched_user` smallint(5) unsigned NOT NULL default '0' ) ENGINE=MyISAM DEFAULT CHARSET=latin1; -- -- Dumping data for table `f2007_scheduling` -- INSERT INTO `f2007_scheduling` VALUES (1, 'ok', 'U-7', 'Red', '02455646', '2007-10-05', 'before Noon', '12:00:00', '1', '', 'Team 1', '20456', 'Field C', '', '2', '', 'Team 3', '123465', 'Field B', 1); INSERT INTO `f2007_scheduling` VALUES (2, 'ok', 'U-14', 'Blue', '789643', '2007-09-06', '', '00:00:00', '5', '', 'Team 5', '7452', 'Field P', '8', '3', '', 'Team 7', '8964', 'Field F', 1); Quote Link to comment https://forums.phpfreaks.com/topic/53993-solved-time-formatting/page/2/#findComment-267055 Share on other sites More sharing options...
kemper Posted June 3, 2007 Author Share Posted June 3, 2007 OK, Now I tried this: $time = "20:18:05"; // make this your pull from the database.  $display_time = date("h:i A", strtotime($time));  will display as  08:18 PM  Snowdog  The good news is... I did not get 12:00 am. Both test records that I created in my table display as 5:59 PM. Where is this time coming from?  Any suggestions? Quote Link to comment https://forums.phpfreaks.com/topic/53993-solved-time-formatting/page/2/#findComment-267451 Share on other sites More sharing options...
per1os Posted June 3, 2007 Share Posted June 3, 2007 Well for starters the data in your database, is 12:00 am and 12:00 pm... Let's do this to do a test k? Â <?php mysql_connect("localhost", "yourusername", "yourpassword"); mysql_select_db("yourdbname"); // insert a statment for 1:05 PM for testing. mysql_query("INSERT INTO `f2007_scheduling` VALUES (2, 'ok', 'U-14', 'Blue', '789643', '2007-09-06', '', '13:05:00', '5', '', 'Team 5', '7452', 'Field P', '8', '3', '', 'Team 7', '8964', 'Field F', 1);"); $result = mysql_query("select time from f2007_scheduling"); while ($row = mysql_fetch_assoc($result)) { Â Â Â Â echo "Time of " . $row['time'] . " is converted to " . date("h:i A", strtotime($row['time'])); } ?> Â See if that works, if it does the issue is arising in how you are assigning the time variable in your script as it is incorrect. Â Â EDIT: If that does work, try running this re-vamped version of your code and see what happens: Â <?php require_once "maincore.php"; require_once "subheader.php"; require_once "side_left.php"; include LOCALE.LOCALESET."sched.php"; //if (!checkrights("FR")) fallback("../index.php"); if (isset($_POST['edit_sched'])) { $time = stripinput($_POST['time']); $home_field = stripinput($_POST['home_field']); $field_no = stripinput($_POST['field_no']); $result = dbquery("UPDATE f2007_scheduling SET sched_user='".$userdata['user_id']."', time='$time', home_field='$home_field', field_no='$field_no' WHERE id='$id' "); //$result = dbquery("UPDATE ".$db_prefix."faq_cats SET faq_cat_name='$faq_cat_name' WHERE faq_cat_id='$faq_cat_id'"); } if ($step == "edit"){ //$data = dbarray(dbquery( // "SELECT ter.*, user_id,user_name FROM f2007_scheduling ter // LEFT JOIN ".$db_prefix."users tusr ON ter.sched_user=tusr.user_id // WHERE id='$id'" // )); $data = dbarray(dbquery("SELECT * FROM f2007_scheduling WHERE id='$id'")); // note change here $display_time = date("h:i a", strtotime($data['time'])); opentable ($locale['sched001']); echo "<form name='reportform' method='post' action='".FUSION_SELF."?id=$id'> ".$locale['sched120']." <table align='center' cellspacing='5' cellpadding='5' class='tbl' width='375'> <tr> <td width='124' valign='top'> <p style='margin-top: 0; margin-bottom: 0'><b>Age:</b></td> <td width='216' valign='top'> <p style='margin-top: 0; margin-bottom: 0'>".$data['age']."</td> </tr> <tr> <td valign='top' width='124'> <p style='margin-top: 0; margin-bottom: 0'><b>Division:</b></td> <td valign='top' width='216'> <p style='margin-top: 0; margin-bottom: 0'>".$data['division']."</p> </td> </tr> <tr> <td width='124' valign='top'> <p style='margin-top: 0; margin-bottom: 0'><b>Game ID:</b></td> <td width='216' valign='top'> <p style='margin-top: 0; margin-bottom: 0'>".$data['id']."</td> </tr> <tr> <td width='124' valign='top'> <p style='margin-top: 0; margin-bottom: 0'><b>Date:</b></td> <td width=216' valign='top'> <p style='margin-top: 0; margin-bottom: 0'>".$data['date']=date("D, F j, Y",strtotime($data['date']))."</td> </tr> <tr> <td width='124' valign='top'> <p style='margin-top: 0; margin-bottom: 0'><b>Time/Notes:</b></td> <td width='216' valign='top'> <p style='margin-top: 0; margin-bottom: 0'> <span style='background-color: #FFFF00'>".$data['notes']."</span></td> </tr> <tr> <td valign='top' width='124'> <p style='margin-top: 0; margin-bottom: 0'><b>Time</b></td> <td valign='top' width='216'> <p style='margin-top: 0; margin-bottom: 0'>".$display_time."</td> </tr> <tr> <td width='124' valign='top'> <p style='margin-top: 0; margin-bottom: 0'><b>Match-up:</b></td> <td width='216' valign='top'> <p style='margin-top: 0; margin-bottom: 0'>".$data['home_team']."</p> <p style='margin-top: 0; margin-bottom: 0'><font color='#0000FF'>vs.</font> ".$data['visiting_team']."</td> </tr> <tr> <td width='124' valign='top'> <p style='margin-top: 0; margin-bottom: 0'><b>Field:</b></td> <td width='216' valign='top'> <p style='margin-top: 0; margin-bottom: 0'><input type='text' name='home_field' value='".$data['home_field']."' class='textbox' style='width:150px;'></td> </tr> <tr> <td width='124' valign='top'> <p style='margin-top: 0; margin-bottom: 0'><b>Field # or Name:</b></td> <td width='216' valign='top'> <p style='margin-top: 0; margin-bottom: 0'><input type='text' name='field_no' value='".$data['field_no']."' class='textbox' style='width:100px;'></td> </tr> <tr> <td align='center' colspan='2'> <input type='submit' name='edit_sched' value='".$locale['sched135']."' class='button'></td> </tr> </table> </form>\n"; closetable (); } opentable ($locale['sched001']); $sql = dbquery( "SELECT ter.*, user_id,user_name FROM f2007_scheduling ter LEFT JOIN ".$db_prefix."users tusr ON ter.sched_user=tusr.user_id ORDER BY date ASC" ); if (dbrows($sql)) { $i = 0; echo "<table width='100%' cellpadding='0' cellspacing='1' class='tbl-border'> <tr> <td class='tbl2' width='55%'><b>Schedules <font size='1'>(Date - Age Division - Home vs. Visitors)</font></b>:</td> <td align='center' width='15%' class='tbl2'><b>Time/Notes</b>:</td> <td align='center' width='15%' class='tbl2'><b>Field</b>:</td> <td align='center' width='15%' class='tbl2'><b>Options:</b></td> </tr>\n"; while ($data = dbarray($sql)) { $i % 2 == 0 ? $tclass="tbl1" : $tclass="tbl2"; echo "<tr> <td class='$tclass' width='55%'><font size='1'><font color='#0000FF'>".$data['date']." - </font>".$data['age']." ".$data['division']." - ".$data['home_team']." vs. ".$data['visiting_team']."</font></font></td> <td align='center' class='$tclass' width='15%'><font size='1'> <span style='background-color: #FFFF00'>".$data['notes']."</span></font></td> <td align='center' class='$tclass' width='15%'><font size='1'>".$data['home_field']." ".$data['field_no']."</font></td> <td align='center' class='$tclass' width='15%'><a href='".FUSION_SELF."?step=edit&id=".$data['id']."'>".$locale['sched002']."</a></td> </tr>\n"; } echo "</table>\n"; } else { echo "<center><br>\n".$locale['sched141']."<br><br>\n</center>\n"; } closetable(); echo "</td>\n"; require_once BASEDIR."footer.php"; ?> Quote Link to comment https://forums.phpfreaks.com/topic/53993-solved-time-formatting/page/2/#findComment-267455 Share on other sites More sharing options...
kemper Posted June 3, 2007 Author Share Posted June 3, 2007 Received: Time of 08:30:00 is converted to 08:30 AMTime of 16:00:00 is converted to 04:00 PMTime of 13:05:00 is converted to 01:05 PM Quote Link to comment https://forums.phpfreaks.com/topic/53993-solved-time-formatting/page/2/#findComment-267456 Share on other sites More sharing options...
per1os Posted June 3, 2007 Share Posted June 3, 2007 <?php require_once "maincore.php"; require_once "subheader.php"; require_once "side_left.php"; include LOCALE.LOCALESET."sched.php"; //if (!checkrights("FR")) fallback("../index.php"); if (isset($_POST['edit_sched'])) { $time = stripinput($_POST['time']); $home_field = stripinput($_POST['home_field']); $field_no = stripinput($_POST['field_no']); $result = dbquery("UPDATE f2007_scheduling SET sched_user='".$userdata['user_id']."', time='$time', home_field='$home_field', field_no='$field_no' WHERE id='$id' "); //$result = dbquery("UPDATE ".$db_prefix."faq_cats SET faq_cat_name='$faq_cat_name' WHERE faq_cat_id='$faq_cat_id'"); } if ($step == "edit"){ //$data = dbarray(dbquery( // "SELECT ter.*, user_id,user_name FROM f2007_scheduling ter // LEFT JOIN ".$db_prefix."users tusr ON ter.sched_user=tusr.user_id // WHERE id='$id'" // )); $data = dbarray(dbquery("SELECT * FROM f2007_scheduling WHERE id='$id'")); // note change here $display_time = date("h:i a", strtotime($data['time'])); opentable ($locale['sched001']); echo "<form name='reportform' method='post' action='".FUSION_SELF."?id=$id'> ".$locale['sched120']." <table align='center' cellspacing='5' cellpadding='5' class='tbl' width='375'> <tr> <td width='124' valign='top'> <p style='margin-top: 0; margin-bottom: 0'><b>Age:</b></td> <td width='216' valign='top'> <p style='margin-top: 0; margin-bottom: 0'>".$data['age']."</td> </tr> <tr> <td valign='top' width='124'> <p style='margin-top: 0; margin-bottom: 0'><b>Division:</b></td> <td valign='top' width='216'> <p style='margin-top: 0; margin-bottom: 0'>".$data['division']."</p> </td> </tr> <tr> <td width='124' valign='top'> <p style='margin-top: 0; margin-bottom: 0'><b>Game ID:</b></td> <td width='216' valign='top'> <p style='margin-top: 0; margin-bottom: 0'>".$data['id']."</td> </tr> <tr> <td width='124' valign='top'> <p style='margin-top: 0; margin-bottom: 0'><b>Date:</b></td> <td width=216' valign='top'> <p style='margin-top: 0; margin-bottom: 0'>".$data['date']=date("D, F j, Y",strtotime($data['date']))."</td> </tr> <tr> <td width='124' valign='top'> <p style='margin-top: 0; margin-bottom: 0'><b>Time/Notes:</b></td> <td width='216' valign='top'> <p style='margin-top: 0; margin-bottom: 0'> <span style='background-color: #FFFF00'>".$data['notes']."</span></td> </tr> <tr> <td valign='top' width='124'> <p style='margin-top: 0; margin-bottom: 0'><b>Time</b></td> <td valign='top' width='216'> <p style='margin-top: 0; margin-bottom: 0'>".$display_time."</td> </tr> <tr> <td width='124' valign='top'> <p style='margin-top: 0; margin-bottom: 0'><b>Match-up:</b></td> <td width='216' valign='top'> <p style='margin-top: 0; margin-bottom: 0'>".$data['home_team']."</p> <p style='margin-top: 0; margin-bottom: 0'><font color='#0000FF'>vs.</font> ".$data['visiting_team']."</td> </tr> <tr> <td width='124' valign='top'> <p style='margin-top: 0; margin-bottom: 0'><b>Field:</b></td> <td width='216' valign='top'> <p style='margin-top: 0; margin-bottom: 0'><input type='text' name='home_field' value='".$data['home_field']."' class='textbox' style='width:150px;'></td> </tr> <tr> <td width='124' valign='top'> <p style='margin-top: 0; margin-bottom: 0'><b>Field # or Name:</b></td> <td width='216' valign='top'> <p style='margin-top: 0; margin-bottom: 0'><input type='text' name='field_no' value='".$data['field_no']."' class='textbox' style='width:100px;'></td> </tr> <tr> <td align='center' colspan='2'> <input type='submit' name='edit_sched' value='".$locale['sched135']."' class='button'></td> </tr> </table> </form>\n"; closetable (); } opentable ($locale['sched001']); $sql = dbquery( "SELECT ter.*, user_id,user_name FROM f2007_scheduling ter LEFT JOIN ".$db_prefix."users tusr ON ter.sched_user=tusr.user_id ORDER BY date ASC" ); if (dbrows($sql)) { $i = 0; echo "<table width='100%' cellpadding='0' cellspacing='1' class='tbl-border'> <tr> <td class='tbl2' width='55%'><b>Schedules <font size='1'>(Date - Age Division - Home vs. Visitors)</font></b>:</td> <td align='center' width='15%' class='tbl2'><b>Time/Notes</b>:</td> <td align='center' width='15%' class='tbl2'><b>Field</b>:</td> <td align='center' width='15%' class='tbl2'><b>Options:</b></td> </tr>\n"; while ($data = dbarray($sql)) { $i % 2 == 0 ? $tclass="tbl1" : $tclass="tbl2"; echo "<tr> <td class='$tclass' width='55%'><font size='1'><font color='#0000FF'>".$data['date']." - </font>".$data['age']." ".$data['division']." - ".$data['home_team']." vs. ".$data['visiting_team']."</font></font></td> <td align='center' class='$tclass' width='15%'><font size='1'> <span style='background-color: #FFFF00'>".$data['notes']."</span></font></td> <td align='center' class='$tclass' width='15%'><font size='1'>".$data['home_field']." ".$data['field_no']."</font></td> <td align='center' class='$tclass' width='15%'><a href='".FUSION_SELF."?step=edit&id=".$data['id']."'>".$locale['sched002']."</a></td> </tr>\n"; } echo "</table>\n"; } else { echo "<center><br>\n".$locale['sched141']."<br><br>\n</center>\n"; } closetable(); echo "</td>\n"; require_once BASEDIR."footer.php"; ?> Â Well it seems as though the function works, try replacing the old code with this one and run it. Quote Link to comment https://forums.phpfreaks.com/topic/53993-solved-time-formatting/page/2/#findComment-267457 Share on other sites More sharing options...
kemper Posted June 3, 2007 Author Share Posted June 3, 2007 Seems wierd... the 08:30:00 displays 8:30 AM and 16:00:00 displays as 4:00 PM. Now, the new record that you had me insert also reads as 4:00 PM, yet database has it as 01:05:00. How? Why? Â Progress is being made, I do appreciate it. Quote Link to comment https://forums.phpfreaks.com/topic/53993-solved-time-formatting/page/2/#findComment-267462 Share on other sites More sharing options...
kemper Posted June 3, 2007 Author Share Posted June 3, 2007 Dammit! I am an idiot for not reading the new record. It seems to be working correctly. The new record has the same id as one of my original records. It all good. Thanks!  Quote Link to comment https://forums.phpfreaks.com/topic/53993-solved-time-formatting/page/2/#findComment-267463 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.