Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Register Tags Active Topics RSS Search Mark Forums Read

Sponsored Links



How to convert MYSQL into Readable PHP timestamp

Software Development


Reply
 
Thread Tools Search this Thread
  #1  
Old 16-05-2009
Member
 
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?

Reply With Quote
  #2  
Old 16-05-2009
Member
 
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.
Reply With Quote
  #3  
Old 16-05-2009
Member
 
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
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: , , , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "How to convert MYSQL into Readable PHP timestamp"
Thread Thread Starter Forum Replies Last Post
How to convert math text PDF format to Kindle readable format The#Gaelic Portable Devices 7 23-02-2012 12:09 PM
How to convert UTC timestamp value to date and time AsceTic! MS Office Support 2 02-02-2012 07:14 PM
How to convert UNIX timestamp to MySQL Warner Software Development 2 16-05-2009 09:20 PM
Criteria with timestamp in MySQL Kirt Software Development 3 09-05-2009 01:09 PM


All times are GMT +5.5. The time now is 11:00 PM.