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 6724945
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T09:44:55+00:00 2026-05-26T09:44:55+00:00

I want to display $eventdate (saved as a unix time INT value on SQL

  • 0

I want to display $eventdate (saved as a unix time INT value on SQL server), in the format DD/MM/YYYY (or similar).

Thanks!

    ...
    $entry_display .= <<<ENTRY_DISPLAY
    <div class="post">
    $eventdate
    </div>
    ...

EDIT:EDIT:EDIT:EDIT:EDIT:EDIT:EDIT:EDIT:EDIT:EDIT:EDIT:EDIT:EDIT:EDIT:EDIT:EDIT:EDIT:EDIT:EDIT:EDIT:EDIT:EDIT:EDIT:EDIT:EDIT:

Heres the whole code:

<?php
class simpleCMS {

  var $host;
  var $username;
  var $password;
  var $table;

  public function display_public() {
    $q = "SELECT * 
          FROM eventsDB
          WHERE eventdate > UNIX_TIMESTAMP()
          ORDER BY eventdate ASC
          LIMIT 30";
    $r = mysql_query($q);

    if ( $r !== false && mysql_num_rows($r) > 0 ) {
      while ( $a = mysql_fetch_assoc($r) ) {
        $title = stripslashes($a['title']);
        $author = stripslashes($a['author']);
        $bodytext = stripslashes($a['bodytext']);
        $eventdate = stripslashes($a['eventdate']);
        $created = stripslashes($a['created']);


        $entry_display .= <<<ENTRY_DISPLAY

    <div class="post">
        <table class="eventstable" cellspacing="0" cellpadding="0">
  <tr>
    <td><img src="media/icons/icon_calendar.gif"/>  <b>$title </b></td>
    <td class="right">echo date("Y-m-d H:i:s", $eventdate); </td>
  </tr>
  <tr>
    <td colspan="2" class="small">$bodytext <i>by $author</i></td>
  </tr>
</table>
    </div>

ENTRY_DISPLAY;
      }
    } else {
      $entry_display = <<<ENTRY_DISPLAY

    <h2> Your brand new Events Page! </h2>
    <p>
      No entries have been made yet.
      Follow my instructions to make a new event!
    </p>

ENTRY_DISPLAY;
    }
    $entry_display .= <<<ADMIN_OPTION

    <p class="admin_link">
      <a href="{$_SERVER['PHP_SELF']}?admin=97538642"></a>
    </p>

ADMIN_OPTION;

    return $entry_display;
  }

  public function display_admin() {
    return <<<ADMIN_FORM

    <form action="{$_SERVER['PHP_SELF']}" method="post">

      <label for="title">Title:</label><br />
      <input name="title" id="title" type="text" maxlength="150" />
      <div class="clear"></div>

      <label for="bodytext">Body Text:</label><br />
      <textarea name="bodytext" id="bodytext"></textarea>
      <div class="clear"></div>

      <label for="author">Author:</label><br />
      <input name="author" id="author" type="text" maxlength="100" />
      <div class="clear"></div>

      <label for="eventdate">Date (DD/MM/YY):</label><br />
      <input name="eventdate" id="eventdate" type="text" maxlength="100" />
      <div class="clear"></div>

      <input type="submit" value="Create This Event!" />
    </form>

    <br />

    <a href="../events.php">Back to Events</a>

ADMIN_FORM;
  }

  public function write($p) {
    if ( $_POST['title'] )
      $title = mysql_real_escape_string($_POST['title']);
    if ( $_POST['bodytext'])
      $bodytext = mysql_real_escape_string($_POST['bodytext']);
    if ( $_POST['author'])
      $author = mysql_real_escape_string($_POST['author']);
    if ( $_POST['eventdate'])
      $eventdate = strtotime($_POST['eventdate']);
    if ( $title && $bodytext && $author ) {
      $created = time();
      $sql = "INSERT INTO eventsDB VALUES('$title','$bodytext','$created','$author','$eventdate')";
      return mysql_query($sql);
    } else {
      return false;
    }
  }

  public function connect() {
    mysql_connect($this->host,$this->username,$this->password) or die("Could not connect. " . mysql_error());
    mysql_select_db($this->table) or die("Could not select database. " . mysql_error());

    return $this->buildDB();
  }

  private function buildDB() {
    $sql = <<<MySQL_QUERY
CREATE TABLE IF NOT EXISTS eventsDB (
title       VARCHAR(150),
bodytext    TEXT,
created     VARCHAR(100),
author      VARCHAR(100),  
eventdate   INT(15),
)
MySQL_QUERY;

    return mysql_query($sql);
  }
}
?>
  • 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-05-26T09:44:56+00:00Added an answer on May 26, 2026 at 9:44 am

    Just throw it through the date() function.

    $string = date("d/m/Y", $eventdate);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to display the TIME field from my mysql table on my website,
I want to display dates in the format: short day of week, short month,
I am getting Arabic text from server successfully. Retrieved text I want display in
I have a simple quiz application and I want display a nice timer /
I want to display tabular type data, but it will not be coming from
i want to display some information in a listview using the GridView. i have
I want to display the current host and database names in a view. Where
I want to display a thumbnail image in a cell of tableViewController , this
I want to display some WPF elements near to the selected item of a
I want to display an image within a scroll area. The view port of

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.