Jump to content


Photo

Getting now() date to show up in database


  • Please log in to reply
1 reply to this topic

#1 LynneM

LynneM
  • New Members
  • Pip
  • Newbie
  • 8 posts

Posted 14 January 2004 - 05:54 PM

Usine DreamweaverMX, MySQL, PHPadmin.

What is the PHP code that I place the now() in, so that the current date will show up in my DB once a web form has been submitted?

My DB field is "submit_date", the type is "DATE". It adds the default 0000-00-00. But in all my tests I still get the "0000-00-00" with every entry.

Is there some code I need to place on the page using the now()? I thought that the DB would auto fill in a date on submit?

Thanks!
Lynne

#2 Pidde

Pidde
  • Members
  • Pip
  • Newbie
  • 1 posts
  • LocationSweden

Posted 15 January 2004 - 10:18 AM

Hi man,

Now() will get you a result like: 0000-00-00 00:00:00. Otherwise you could change the column to a datetime.

If you want the date only, then use the date() function in PHP.

date('Y-m-d')

This will return:
2004-01-18
Kind regards[br]Peter Kindberg[br][br]Want some custom programming? Contact me for information. I bill $15-$25/hour, depending on the amount of work you want done! Programming comes with lifetime warranty as long as the code is untouched![br]




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users