Results 1 to 3 of 3

Thread: How to convert MYSQL into Readable PHP timestamp

  1. #1
    Join Date
    Apr 2009
    Posts
    89

    How to convert MYSQL into Readable PHP timestamp

    I have timestampt format in Mysql which is of 15 field and that is using date('F d Y', $timestamp); but when i used this format in my programming it won't execute. I am aware about the DATE_FORMAT() function in Mysql but I would like to know if there is a way to do this in PHP?

  2. #2
    Join Date
    Jan 2009
    Posts
    124

    Re: How to convert MYSQL into Readable PHP timestamp

    If you wanted to get an output into mysql timestamp you need to use the following the query

    i.e.SELECT DATE_FORMAT(time, '%F %d %Y') as new_time,table.* FROM table

    The new_time would be the formatted timestamp and the time you are using will be the the mysql timestamp.

  3. #3
    Join Date
    Dec 2008
    Posts
    202

    Re: How to convert MYSQL into Readable PHP timestamp

    I have gone through some book reading and I found that date timestamp does not work according to requirement it shows totally different output but date it also doesn't work on a TIMESTAMP field instead of that it works on a DATE field, when i tried doing that It does formatting the date on a TIMESTAMP field but it gives a wrong date. For example:

    $timestamp = '20050420118004';
    $date = date("F-d-Y", $timestamp);
    print($date); // Returns January-18-2038 when it should be March-11-2005

Similar Threads

  1. How to convert math text PDF format to Kindle readable format
    By The#Gaelic in forum Portable Devices
    Replies: 7
    Last Post: 23-02-2012, 12:09 PM
  2. How to convert UTC timestamp value to date and time
    By AsceTic! in forum MS Office Support
    Replies: 2
    Last Post: 02-02-2012, 07:14 PM
  3. How to convert UNIX timestamp to MySQL
    By Warner in forum Software Development
    Replies: 2
    Last Post: 16-05-2009, 08:20 PM
  4. Criteria with timestamp in MySQL
    By Kirt in forum Software Development
    Replies: 3
    Last Post: 09-05-2009, 12:09 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,711,696,694.79051 seconds with 17 queries