public void testTime() throws SQLException
{
IDBFace DBFace =DBFactory.createMySqlFace();
DBFace.connect();
//清空表
String strDelete ="delete from time_table";
DBFace.update(strDelete);
//添加
String strInsert ="insert into time_table(CreateTime) values(131211)";
DBFace.update(strInsert);
//获取
String strSelect ="select * from time_table";
ResultSet rsBuffer =DBFace.select(strSelect);
while(rsBuffer.next())
{
Time tmBuffer =rsBuffer.getTime("CreateTime");
System.out.println(tmBuffer.toString());
}
DBFace.close();
}
执行结果: 13:12:11
Year
A year in two-digit or four-digit format. The default is four-digit format. In four-digit format, the allowable values are 1901 to 2155, and 0000. In two-digit format, the allowable values are 70 to 69, representing years from 1970 to 2069. MySQL displays YEAR values in YYYY format, but allows you to assign values to YEAR columns using either strings or numbers. The YEAR type is unavailable prior to MySQL 3.22.
Year可以有2种表示方式,4位的和2位的。
默认情况是4位。其范围为1901-2155
2位的表述法只记录后2位 。其范围为1970-2069
允许以字符串或者数字的方式插入。
代码:
复制代码 代码如下: