activejdbc如何获取oracle中date类型字段的时分秒呀?

张胜军 发布于 2013/04/19 10:02
阅读 435
收藏 0

数据库中数据如下:

2013/3/4
2013/3/4 11:30:26
2013/2/25 12:22:21
2013/2/25 12:22:21

代码如下:
        Base.open("oracle.jdbc.driver.OracleDriver", "jdbc:oracle:thin:@localhost :1521:demo", "demo", "demo");
        List<XiaoYan> xys = XiaoYan.where("created is not null");
        for(XiaoYan xiaoYan:xys){
            System.out.println(xiaoYan.get("created")+", "+xiaoYan.getDate("created")+", "+xiaoYan.getTimestamp("created"));
        }

输出结果如下:

2013-03-04, 2013-03-04, 2013-03-04 00:00:00.0
2013-03-04, 2013-03-04, 2013-03-04 00:00:00.0
2013-02-25, 2013-02-25, 2013-02-25 00:00:00.0
2013-02-25, 2013-02-25, 2013-02-25 00:00:00.0


加载中
返回顶部
顶部