date format outside of query

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
Jim_Bo
Forum Contributor
Posts: 390
Joined: Sat Oct 02, 2004 3:04 pm

date format outside of query

Post by Jim_Bo »

Hi,

Can the following code be set outside of an sql query .. mainly so I dont have to list all the fields within SELECT and use * instead:

Code: Select all

DATE_FORMAT(ADDDATE(last_login, INTERVAL 16 HOUR), '%d-%b-%Y %r') AS last_login

Cheers
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

or just do....

Code: Select all

SELECT *, DATE_FORMAT(ADDDATE(last_login, INTERVAL 16 HOUR), '%d-%b-%Y %r') AS last_login FROM table...
Jim_Bo
Forum Contributor
Posts: 390
Joined: Sat Oct 02, 2004 3:04 pm

Post by Jim_Bo »

Hi,

Oh that crossed my mind but assumed it wouldnt work ..

Cheers
Post Reply