You are here: Re: date problem « PHP Programming Language « IT news, forums, messages
Re: date problem

Posted by Pedro Graca on 10/08/06 20:17

[ crossposted by me to comp.databases.mysql, followups set ]

iulian.ilea wrote:
> I store a date ( format mm/dd/yyyy ) on MsSQL in a datetime field. In
> DB is stored correctly, same format, but when I retrieve it I get
> dd/mm/yyyy. You have any ideea why this is happening?

My MySQL does no accept dates in that format

mysql> create table xx (xx_id int(1), d datetime);
Query OK, 0 rows affected (0.01 sec)

mysql> insert xx values
-> (1, 10/08/2006), (2, '10/08/2006'),
-> (3, 2006-10-08), (4, '2006-10-08'),
-> (5, 10082006), (6, 20061008);
Query OK, 6 rows affected, 4 warnings (0.00 sec)
Records: 6 Duplicates: 0 Warnings: 4

mysql> select * from xx;
+-------+---------------------+
| xx_id | d |
+-------+---------------------+
| 1 | 0000-00-00 00:00:00 |
| 2 | 0000-00-00 00:00:00 |
| 3 | 0000-00-00 00:00:00 |
| 4 | 2006-10-08 00:00:00 |
| 5 | 0000-00-00 00:00:00 |
| 6 | 2006-10-08 00:00:00 |
+-------+---------------------+
4 rows in set (0.00 sec)

mysql> drop table xx;
Query OK, 0 rows affected (0.00 sec)

MySQL *always* interprets dates as YYYY-MM-DD
Check the MySQL manual
http://dev.mysql.com/doc/refman/5.0/en/date-and-time-types.html

--
File not found: (R)esume, (R)etry, (R)erun, (R)eturn, (R)eboot

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация