⚠ In case you've missed it, we have migrated to our new website, with a brand new forum. For more details about the migration you can read our blog post for website migration. This is an archived forum. ⚠

  •     

profile picture

Date field, dates before year 100



AdamC

AdamC
  • profile picture
  • Member

Posted 16 June 2018 - 14:51 PM

Hi,

 

I found following problem. Sample table:

 

+-------+---------+------+-----+---------+----------------+
| Field | Type    | Null | Key | Default | Extra          |
+-------+---------+------+-----+---------+----------------+
| id    | int(11) | NO   | PRI | NULL    | auto_increment |
| d     | date    | YES  |     | NULL    |                |
+-------+---------+------+-----+---------+----------------+
 

code:

 

            $crud = new grocery_CRUD();
            $crud->set_table('a');
            $crud->set_subject('a');
            $crud->set_theme('flexigrid');
            $output = $crud->render();
            $this->_example_output($output);

 

When I add d = 01/01/0101 it looks ok in DB:

 

+----+------------+
| id | d          |
+----+------------+
|  1 | 0101-01-01 |
+----+------------+
 

but when I try to add d = 01/01/0100 I get:

 

+----+------------+
| id | d          |
+----+------------+
|  1 | 2000-01-01 |
+----+------------+
 

same with d= 00/00/0000

 

+----+------------+
| id | d          |
+----+------------+
|  1 | 1999-11-30 |
+----+------------+
 

What's wrong ?

 

I can update record in db using mariadb console:

 

MariaDB [aoc]> update a set d='0000-00-00';
Query OK, 1 row affected (0.04 sec)
Rows matched: 1  Changed: 1  Warnings: 0

MariaDB [aoc]> select * from a;
+----+------------+
| id | d          |
+----+------------+
|  1 | 0000-00-00 |
+----+------------+
1 row in set (0.00 sec)
 

 

 

 

 


AdamC

AdamC
  • profile picture
  • Member

Posted 20 June 2018 - 06:32 AM

Solved