• 0

[sql] date stamping


Question

I have some SQL code which has created a table in MySQL

CREATE TABLE merchants (

merchantid int(11) NOT NULL auto_increment PRIMARY KEY,

merchantname varchar(255) NOT NULL,

merchanturl varchar(255) NOT NULL,

categoryid int(11) NOT NULL,

merchantdateadded timestamp(14) NOT NULL

The timestamp automatically added the date/time when the data is added to table. The format of the timestamp is something like:

2008-12-03 22:59:14

What I want is just the date

e.g.

2008-12-03

How can this be done??

Thanks

Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 0

its ok, figured out that i needed to change the actual sql query

the code is now something like:

$sql = "SELECT * FROM vouchers WHERE date(dateadded) = '2008-12-04'

Link to comment
Share on other sites

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.