469,890 Members | 2,164 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,890 developers. It's quick & easy.

Date format problem...

Isn't the following date format supposed to work with any installation of
MySQL?

YYYY-MM-DD HH:NN:SS

It's not working on one system... the date is shown as all zero's.
Jul 20 '05 #1
6 2165
Greg wrote:
Isn't the following date format supposed to work with any installation of
MySQL?

YYYY-MM-DD HH:NN:SS

It's not working on one system... the date is shown as all zero's.


Can you show example how to make it show all zeros? I would like to see
something like this (Except in my example the datetime seems to work fine):
mysql> create table datetimetest( col1 datetime );
Query OK, 0 rows affected (0.02 sec)

mysql> insert into datetimetest values( now() );
Query OK, 1 row affected (0.00 sec)

mysql> insert into datetimetest values( '2000-01-01 10:10:22' );
Query OK, 1 row affected (0.00 sec)

mysql> select * from datetimetest;
+---------------------+
| col1 |
+---------------------+
| 2004-07-30 19:59:38 |
| 2000-01-01 10:10:22 |
+---------------------+
2 rows in set (0.01 sec)
Jul 20 '05 #2
Greg wrote:
Isn't the following date format supposed to work with any installation of
MySQL?

YYYY-MM-DD HH:NN:SS

It's not working on one system... the date is shown as all zero's.


Do you mean the date format when inserting, as in:
insert into myTable (myDateColumn) values("2004-07-30 10:48:00");

or do you mean the date format when selecting, as in:
select date_format(myDateColumn, "%Y-%m-%d %T") from myTable;

Regards,
Bill K.
Jul 20 '05 #3
"Bill Karwin" <bi**@karwin.com> wrote in message
news:ce********@enews3.newsguy.com...
Greg wrote:
Isn't the following date format supposed to work with any installation of MySQL?

YYYY-MM-DD HH:NN:SS

It's not working on one system... the date is shown as all zero's.


Do you mean the date format when inserting, as in:
insert into myTable (myDateColumn) values("2004-07-30 10:48:00");

or do you mean the date format when selecting, as in:
select date_format(myDateColumn, "%Y-%m-%d %T") from myTable;

Regards,
Bill K.


Like your first example. It happens when doing it from an application.
This is happening with MySQL v4.1 beta on one system (other systems are
using v4.0)
Jul 20 '05 #4
Greg wrote:
Like your first example. It happens when doing it from an application.
This is happening with MySQL v4.1 beta on one system (other systems are
using v4.0)


Echo/Print out the exact query (filled with values, not those containing
$variable or stuff like that) you are using and copy-paste it here.
Because most common reason for problems like this is that the query is
incorrectly formed.
Jul 20 '05 #5
"Bill Karwin" <bi**@karwin.com> wrote in message
news:ce********@enews3.newsguy.com...
Greg wrote:
Isn't the following date format supposed to work with any installation of MySQL?

YYYY-MM-DD HH:NN:SS

It's not working on one system... the date is shown as all zero's.


Do you mean the date format when inserting, as in:
insert into myTable (myDateColumn) values("2004-07-30 10:48:00");

or do you mean the date format when selecting, as in:
select date_format(myDateColumn, "%Y-%m-%d %T") from myTable;

Regards,
Bill K.


Like your first example. It happens when doing it from an application.
This is happening with MySQL v4.1 beta on one system (other systems are
using v4.0)
Jul 20 '05 #6
Greg wrote:
Like your first example. It happens when doing it from an application.
This is happening with MySQL v4.1 beta on one system (other systems are
using v4.0)


Echo/Print out the exact query (filled with values, not those containing
$variable or stuff like that) you are using and copy-paste it here.
Because most common reason for problems like this is that the query is
incorrectly formed.
Jul 20 '05 #7

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

6 posts views Thread by Dario Di Bella | last post: by
12 posts views Thread by Assimalyst | last post: by
30 posts views Thread by fniles | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.