Re: Storing Date in mysql

From: Date: Thu, 08 Jul 2004 17:17:38 +0000
Subject: Re: Storing Date in mysql
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-35150@lists.php.net to get a copy of this message
Hello Michael, token_date must be a DATE FIELD... http://dev.mysql.com/doc/mysql/en/Column_types.html MG> Hello, MG> I need to store the date of record / entry in the mysql database, so I have the MG> following table create statement: MG> CREATE TABLE token_table ( MG> token_id int(11) NOT NULL auto_increment, MG> token_utuser_id int(11) NOT NULL default '0', MG> token_name varchar(100) NOT NULL default '', MG> token_date varchar(100) NOT NULL default '', MG> token_user_id varchar(100) default '', MG> token_ticket_id varchar(100) default '', MG> token_data varchar(100) default '', MG> PRIMARY KEY (token_id), MG> KEY tokencheck MG> (token_utuser_id,token_name) MG> ) TYPE=MyISAM; MG> So in the token_date field I am storing the date in the following format from PHP: MG> date("d/m/Y") which creates the following entry "05/07/2004" (example). MG> I would like to know fro the list is ... is this the best way to store the date ? Would this MG> be easy to select against ? MG> Michael. -- Best regards, Pablo

« previous php.db (#35150) next »