473,405 Members | 2,334 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

mysql 3.23 datatime problem

Sun
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

Jul 23 '05 #1
3 1554

"Sun" <sf******@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
Jul 23 '05 #2
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/da...ime-types.html

Hopes this helps.

Jul 23 '05 #3
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.
Jul 23 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: JL | last post by:
Platform: Linux Red Hat RHEL 3 (and red hat 9) Installed MySQL from source. As a matter of fact, installed all LAMPS from source, and the mysql socket file was arranged in a place other than...
0
by: Lenz Grimmer | last post by:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hi, MySQL 4.0.14, a new version of the popular Open Source/Free Software Database, has been released. It is now available in source and binary...
3
by: Kirk Soodhalter | last post by:
Hi, This started as a phpmyadmin problem, but has somehow morphed into a mysql problem. I don't know how to fix it. I am posting the conversation from a php newsgroup since it started there. ...
0
by: Plymouth Acclaim | last post by:
Hi guys, We have a problem with Dual AMD64 Opteron/MySQL 4.0.18/Mandrake 10 for a very high volume site. We are evaluating the performance on our new server AMD64 and it seems it's slow compared...
8
by: Zibi | last post by:
I have some problem with datatime. SELECT * FROM stat WHERE data > '2005-05-24 14:07:28' ORDER BY id Asc I got the error: Microsoft OLE DB Provider for SQL Server error '80040e07' The...
14
by: expertware | last post by:
Ok! to avoid confusion I will start a new argument. Thanks!! FIREFOX 1.0.7 AND IE6 viewed through DATATIME: a summary REPORT ===============================================================...
5
by: Megi | last post by:
Helo, I have problem in finding right tutorial how to create multi key in DB. I have 4 tables. in each I have TIME datatime Nr int I want them as a MUL key, could You help me in creating...
39
by: alex | last post by:
I've converted a latin1 database I have to utf8. The process has been: # mysqldump -u root -p --default-character-set=latin1 -c --insert-ignore --skip-set-charset mydb mydb.sql # iconv -f...
1
by: mohananu | last post by:
hi, please help me out.... I have 2 table, Say T1 and T2 Above 2 table have a datatime field in it. I want to left join this two table such that if(T1.datatime field > T2.datatime field) ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.