Date Stamp

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
Yanayaya
Forum Commoner
Posts: 42
Joined: Tue Dec 02, 2008 7:49 am

Date Stamp

Post by Yanayaya »

I have a PHP CMS that I made for the submission of news articles to a mysql database. What I would like to do is include the date the article was created. I was trying to use DATE_STAMP in my sql but it was retunring 0000-00-00 on every entry.

Is there a way I can have php grab the date and save it along with the article and include it in the displayed articles after submission is complete? :banghead:
User avatar
papa
Forum Regular
Posts: 958
Joined: Wed Aug 27, 2008 3:36 am
Location: Sweden/Sthlm

Re: Date Stamp

Post by papa »

You can use the timestamp function in mysql and then retrieve it to be displayed. Otherwise date() is your friend.
User avatar
aceconcepts
DevNet Resident
Posts: 1424
Joined: Mon Feb 06, 2006 11:26 am
Location: London

Re: Date Stamp

Post by aceconcepts »

You can use DATE as the data type in the DB and date("Y-m-d") in PHP.
Yanayaya
Forum Commoner
Posts: 42
Joined: Tue Dec 02, 2008 7:49 am

Re: Date Stamp

Post by Yanayaya »

Ahh, job done, cheers fella's :mrgreen: :drunk:
Post Reply