The SitePoint Forums have moved.

You can now find them here.
This forum is now closed to new posts, but you can browse existing content.
You can find out more information about the move and how to open a new account (if necessary) here.
If you get stuck you can get support by emailing forums@sitepoint.com

If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

Loggedin date

Hi,
I store date as 2007-06-01 11:39:04 in db for loggedin users.
Now i am showing the login as last login: 01-06-2007 11:39:04 .
How can i change the db date to the date above i mention as 01-06-2007 11:39:04.

Its faster if you format it as it comes out of the database by using the date_format functions provided by your database. No need to run that php code every time you need to display a date as well.

If the date in the database isn't stored in an actual datetime field, then you will need to cast it first to a datetime data type before you can use the format function. Either way, its still faster to do it in the db server as part of the sql statement when you extract it. Particularly if you have a lot of them to do.