Kim Jacobs - MWEB wrote:

I have a script which pulls a date(date default NULL) and a time (time default NULL) 
from a MySQL database, now I would like to display that date and time in a 'pretty' 
format.

I've been able to show the date nicely with the help of this:

                $ntime=strtotime($row['date'] $row['time']);
                $ndate=date('D d F Y H:i',$ntime);

This shows the date in a 'nice' format (2004-05-10 20:40:00 is shown as Mon 10 May 
2004 00:00), however, it shows the time as 00:00 for all of the games no matter what 
the time is. How do I get it to show the date as 20:40 or 20h40 or 8:40 PM?

If I change the lines to this:
                $ntime=strtotime("$row[date] $row[time] GMT");
                $ndate=date('D d F Y H:i',$ntime);
the only difference is that it now shows Mon 10 May 2004 02:00 (probably because we 
are 2 hours ahead of GMT)

Any ideas please?

Thanks
K



Well, a solution could easily be arranged to use both fields, but really, the best thing to do is to just use a DATETIME field in MySQL instead of using both DATE and TIME fields. That will save you a lot of headaches now and in the future.


    Bruno Ferreira
---
[This E-mail scanned for viruses by Declude Virus]

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to