www.webdeveloper.com
Results 1 to 8 of 8

Thread: [RESOLVED] Mysql Timestamp and PHP - Best way to display time

Threaded View

  1. #1
    Join Date
    Jul 2010
    Posts
    35

    resolved [RESOLVED] Mysql Timestamp and PHP - Best way to display time

    I have searched the Net and come up empty-handed; I wonder if anyone here could assist me in resolving this issue.

    I would like the data stored in a MySQL TIMESTAMP field to be called and displayed using PHP. I have already created the necessary MySQL columns in a table to record the date of creation and the date of modifiction, and a script to insert them into the table:

    PHP Code:
    $query "INSERT INTO articles VALUES
    ('','
    $page_title','$content_title','$author',null,null,'$content')"
    (See attached graphic for a screenshot of the corresponding table.)

    This process works great; however, my problem arises when I retrieve the data from the database. The date is stored in this format:

    2010-12-24 06:51:26, and when I pull the date into the webpage by merely assigning the data in that field a variable and calling the variable, it is displayed on the webpage exactly as it is stored in the database.

    Does anyone

    1) know how to change the timezone and / or format the date to a more user friendly format - between the time the date leaves the database and the time that it is printed on the page?

    2) have a better way of storing dates than the MySQL method that I am using?

    All help will be greatly appreciated.
    Attached Images Attached Images
    Last edited by Mr. Baggins; 12-24-2010 at 11:17 AM. Reason: forgot to attach graphic

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles