Jump to content


Date field, dates before year 100

date

  • Please log in to reply
1 reply to this topic

#1 AdamC

AdamC

    Newbie

  • Members
  • Pip
  • 2 posts

Posted 16 June 2018 - 02: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)
 

 

 

 

 



#2 AdamC

AdamC

    Newbie

  • Members
  • Pip
  • 2 posts

Posted 20 June 2018 - 06:32 AM

Solved







Also tagged with one or more of these keywords: date

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users