Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8222973
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T14:30:17+00:00 2026-06-07T14:30:17+00:00

I have an event agenda set up to populate from a database, echoing rows

  • 0

I have an event agenda set up to populate from a database, echoing rows from a loop.

I see how to format to get the time that I want: date(“g:i a”) BUT I can’t seem to make it work within my php code.

I’m having the loop print the data to a $row, and then specifying which piece of data like this:

    <td>' .$row['start_time'] . '</td>

In which start_time is the column in my database that is the datetime piece of data.

I’ve tried a few different ways of adding in the formatting for the date time, but none of them have successfully returned results. How do I format this code so it will show up? Do I make it a function or can I add it to the line I have here?

I’d like to just return the time (not the date), and have it be something like 7:00am.

Thank you!

Edit to add: Here is more code that may shed light on where I’m struggling:

   $conn = new DatabaseConn();

   $query = "SELECT * FROM agenda WHERE date=\"2012-10-21\" AND visible=\"1\" ORDER BY agenda_id;";

   $result = mysql_query($query);

   if($result){

    $numfields = mysql_num_fields($result);
    $data = array();
    $flist = array();

        for($i=0;$i<$numfields;$i++)$flist[] = mysql_field_name($result,$i);
        $data[0] = $flist;
        while($row = mysql_fetch_assoc($result)){

         $data[] = $row;
         echo '
         <tr>
          <td id="time">'. $row['start_time']) . '</td>
          <td id="time">' . $row['end_time'] . '</td>   
          <td id="title">' . $row['title'] . '</td>
          <td id="description">' . $row['description'] . '</td>
          <td id="room">' . $row['room'] . '</td>
          <td id="type">' . $row['attendee_type'] . '</td>          
         </tr>
         ';
        }

Edit #2 to add: Here’s my output on the test page:
(copied the view source instead of just the page)

    <tr>
     <td id="time">2012-10-21 14:00:00 </td>
     <td id="time">2012-10-21 20:00:00</td>
     <td id="title">Registration</td>
     <td id="description">Open registration and conference check-in.</td>
     <td id="room">Lobby</td>
     <td id="type">all</td>
    </tr>                   
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T14:30:19+00:00Added an answer on June 7, 2026 at 2:30 pm

    Use this

    echo date("g:i a", $row['start_time']); //$row['start_time'] should be Unix timestamp
    

    Otherwise use

    echo date("g:i a", strtotime($row['start_time'])); 
    

    strtotime parses English textual datetime description into a Unix timestamp

    Go through this to know about all date format characters.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have event Button that creates text box in run time. Private Sub Button1_Click(ByVal
I have an Event model that includes a start time field, which is stored
I have event manager process that dispatches events to subscribers (e.g. http_session_created, http_sesssion_destroyed). If
If have an event that fires when a user clicks outside of text field,
I'm about to have to write a web page/app that will serve the agenda
I have following models: - Agenda (id, user_id, event_id) -> belongsto Event, User -
For example, we have event that will go every 3 month. Event have DateStart,
I have lots of functions and event handlers that are split across multiple javascript
Using winforms, I have set the KeyPreview property to true and have event handles
I have Event model instances that can belong to one or more Organization model

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.