kemper Posted June 2, 2007 Share Posted June 2, 2007 When I insert ".$data['date'].", I receive the date as 2007-10-05. How can I get this data to display as Friday, October 5, 2007 (%W, %M %e, %Y)? Link to comment https://forums.phpfreaks.com/topic/53935-solved-datadate-formatting-in-php/ Share on other sites More sharing options...
fert Posted June 2, 2007 Share Posted June 2, 2007 $date['date']=date("D, F j, o",strtotime($date['date'])); That should work Link to comment https://forums.phpfreaks.com/topic/53935-solved-datadate-formatting-in-php/#findComment-266684 Share on other sites More sharing options...
kemper Posted June 2, 2007 Author Share Posted June 2, 2007 Where would I place that, since I place ".$data['date']." where I want it displayed? My script 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"); 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."'> 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']."</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['time_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'> <input type='text' name='time' value='".$data['time']."' class='textbox' style='width:100px;'></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['time_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"; ?> Link to comment https://forums.phpfreaks.com/topic/53935-solved-datadate-formatting-in-php/#findComment-266686 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.