Welcome to dbFreaks.com!
FAQFAQ      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

mysql 3.23 datatime problem

 
   Database Help (Home) -> mySQL RSS
Next:  No QBE Queries in Multi-user Apps - Liz  
Author Message
sfgroups

External


Since: Dec 15, 2004
Posts: 1



(Msg. 1) Posted: Fri Feb 18, 2005 2:00 pm
Post subject: mysql 3.23 datatime problem
Archived from groups: mailing>database>mysql (more info?)

Hi all,

I am inserting datatime value into mysql table, while select value its
giving 0000-00-00 00:00:00 value.


mysql> insert into dtest values('02-17-05 17:08:02');
Query OK, 1 row affected (0.00 sec)

mysql> select * from dtest;

+---------------------+
| mydate |
+---------------------+
| 0000-00-00 00:00:00 |
+---------------------+
1 row in set (0.00 sec)

mysql> desc dtest;
+--------+----------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+--------+----------+------+-----+---------+-------+
| mydate | datetime | YES | | NULL | |
+--------+----------+------+-----+---------+-------+
1 row in set (0.00 sec)


Any help to fix this problem.

-SR

 >> Stay informed about: mysql 3.23 datatime problem 
Back to top
Login to vote
Bill Karwin1

External


Since: Jun 17, 2004
Posts: 42



(Msg. 2) Posted: Fri Feb 18, 2005 2:32 pm
Post subject: Re: mysql 3.23 datatime problem [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Sun wrote:
 > mysql> insert into dtest values('02-17-05 17:08:02');

Try '2005-02-17 17:08:02'. MySQL accepts date formats only in one
format, YYYY-MM-DD.

Regards,
Bill K.<!-- ~MESSAGE_AFTER~ -->

 >> Stay informed about: mysql 3.23 datatime problem 
Back to top
Login to vote
bturczyn

External


Since: Jan 10, 2005
Posts: 7



(Msg. 3) Posted: Fri Feb 18, 2005 2:34 pm
Post subject: Re: mysql 3.23 datatime problem [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Although MySQL tries to interpret values in several formats, it always
expects the year part of date values to be leftmost. Dates must be
given in year-month-day order (for example, '98-09-04'), rather than in
the month-day-year or day-month-year orders commonly used elsewhere
(for example, '09-04-98', '04-09-98').
http://dev.mysql.com/doc/mysql/en/date-and-time-types.html

Hopes this helps.
 >> Stay informed about: mysql 3.23 datatime problem 
Back to top
Login to vote
dstumpus_nosp

External


Since: Jan 15, 2005
Posts: 3



(Msg. 4) Posted: Fri Feb 18, 2005 10:22 pm
Post subject: Re: mysql 3.23 datatime problem [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

"Sun" <sfgroups DeleteThis @gmail.com> wrote

 > mysql> insert into dtest values('02-17-05 17:08:02');
 > Query OK, 1 row affected (0.00 sec)
 >
 > mysql> select * from dtest;
 >
 > +---------------------+
 > | mydate |
 > +---------------------+
 > | 0000-00-00 00:00:00 |
 > +---------------------+
 > 1 row in set (0.00 sec)

This works:

insert into dtest values('2005-02-17 17:08:02');

Explained under the datetime datatype in the manual...

-- Dan<!-- ~MESSAGE_AFTER~ -->
 >> Stay informed about: mysql 3.23 datatime problem 
Back to top
Login to vote
Display posts from previous:   
Related Topics:
Mysql InnoDB PHP result problem - i have a strange problem : MySQL 4.0.21 innodb and php 4.3.9-1 all tables are in innodb type. For a simple select statement sometimes i get result and sometimes nothing (i.e mysql_num_rows()>0 or mysql_num_rows()==0). It's a random behaviour. If my t...

Tuning Mysql 4.1.10 - I have a freebsd box with 1 gig of memory for mysql/php, I was wondering what my my.cnf should look like, I am doing alot of searches and writes on ISAM tables, I currently have the following: [client] port=3306 socket=/tmp/mysql.sock [mysqld]..

Mysql InnoDB PHP - i have a strange problem : MySQL 4.0.21 innodb and php 4.3.9-1 all tables are in innodb type. For a simple select statement, sometimes i get result and sometimes nothing (i.e mysql_num_rows()>0 or mysql_num_rows()==0). It's a random behaviour. If my....

Installation and config of MYSQL - Hi, Need help. Installed Mysql in Redhat 9.0 workstation. I have installed MYSQL,Appache,PHP. PHP,Appache installation is fine and intergration is also working fine. I have installed and configured MYSQL Problem : I cannot log into MYSQL database either...

MySQL, MyODBC and ACCESS 2003 - Ok I have an interesting problem. I have written a database in Access to connect to our web shop and update prices etc from a supplier feed. It works almost perfectly! The prices are doubles, I am using ADO in access to connect via myodbc (with options....
   Database Help (Home) -> mySQL All times are: Pacific Time (US & Canada) (change)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You can edit your posts in this forum
You can delete your posts in this forum
You can vote in polls in this forum



[ Contact us | Terms of Service/Privacy Policy ]