Outputting Date

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
sampage
Forum Newbie
Posts: 22
Joined: Sat Mar 18, 2006 6:17 pm

Outputting Date

Post by sampage »

In my database I have a user_lastlogin which is stored as a datetime value. i.e. 0000-00-00 00:00:00

When I echo this date for example like this:

Code: Select all

....
$user_lastlogin = $myrow['user_lastlogin'];

echo $user_lastlogin;
How do I control the output so that it is displayed time - date?
User avatar
phpScott
DevNet Resident
Posts: 1206
Joined: Wed Oct 09, 2002 6:51 pm
Location: Keele, U.K.

Post by phpScott »

date_format on the db side of things is probably easiest.
Find date_format on this page http://dev.mysql.com/doc/refman/4.1/en/ ... tions.html
Post Reply