Wrox Programmer Forums
Go Back   Wrox Programmer Forums > PHP/MySQL > PHP Databases
|
PHP Databases Using PHP in conjunction with databases. PHP questions not specific to databases should be directed to one of the other PHP forums.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the PHP Databases section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 1st, 2003, 08:47 AM
Authorized User
 
Join Date: Oct 2003
Posts: 91
Thanks: 0
Thanked 0 Times in 0 Posts
Default DATE VALUE DISPLAYED NOT AS ENTERED

i build the sales table as below using mysql but the date value that i entered is not the one displayed on the database.

What is the problem? Please help.

mysql> CREATE TABLE SALES
    -> (
    -> SALES_ID INT NOT NULL,
    -> SALES_DATE TIME NOT NULL,
    -> PRIMARY KEY(SALES_ID),
    -> );
Query OK, 0 rows affected (0.02 sec)

mysql> INSERT INTO SALES VALUES(10001,'1998-08-18');
Query OK, 1 row affected (0.00 sec)

mysql> INSERT INTO SALES VALUES(10002,'1999-03-30');
Query OK, 1 row affected (0.01 sec)

mysql> SELECT * FROM SALES;
+----------+------------+
| SALES_ID | SALES_DATE |
+----------+------------+
| 10001 | 00:00:00 |
| 10002 | 00:00:00 |
+----------+------------+
2 rows in set (0.00 sec)

 
Old November 1st, 2003, 12:56 PM
richard.york's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 1,706
Thanks: 0
Thanked 6 Times in 6 Posts
Default

Um I think you want to use a 'date' or 'datetime' field type for that.

http://www.mysql.com/doc/en/DATETIME.html

: )
Rich

:::::::::::::::::::::::::::::::::
Smiling Souls
http://www.smilingsouls.net
:::::::::::::::::::::::::::::::::
 
Old November 4th, 2003, 10:36 PM
Authorized User
 
Join Date: Oct 2003
Posts: 91
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Yup, thanks. i've overlooked. i should have use DATE instead of TIME.






Similar Threads
Thread Thread Starter Forum Replies Last Post
Exception Entered mh VB.NET 4 October 18th, 2005 12:12 PM
Time displayed with date! Please help Renu ASP.NET 1.0 and 1.1 Basics 18 August 20th, 2004 09:04 AM
Time getting displayed along with Date mahulda Classic ASP Databases 15 August 16th, 2004 02:05 PM
Date and Time Displayed Together in DataGrid mahulda Classic ASP Databases 4 July 17th, 2004 11:03 PM
Date and Time Displayed Together in DataGrid mahulda ADO.NET 2 July 16th, 2004 04:43 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.