您可以使用MySQL命令行轻松插入DateTime。以下是语法-
insert into yourTableName values(‘yourDateTimeValue’);
让我们首先创建一个表-
mysql> create table DemoTable ( DateOfBirth datetime );
使用插入命令在表中插入一些记录-
mysql> insert into DemoTable values('1998-01-23 12:45:56'); mysql> insert into DemoTable values('2010-12-31 01:15:00'); mysql> insert into DemoTable values('2015-04-03 14:00:45');
使用select语句显示表中的所有记录-
mysql> select *from DemoTable;
这将产生以下输出-
+---------------------+ | DateOfBirth | +---------------------+ | 1998-01-23 12:45:56 | | 2010-12-31 01:15:00 | | 2015-04-03 14:00:45 | +---------------------+ 3 rows in set (0.00 sec)