oracle.jbo.domain.Datejava.utils.Datejava.sql.Date时间转换测试

oracle.jbo.domain.datejava.utils.datejava.sql.date时间转换测试

 public static void main(string[] args) {
        string time = "2014-02-19";
        simpledateformat df = new simpledateformat("yyyy-mm-dd");
        java.sql.timestamp jstdate =
            new java.sql.timestamp(system.currenttimemillis());

        java.util.date currentjudate =
            new java.util.date(system.currenttimemillis());
        oracle.jbo.domain.date currentojddate =
            new oracle.jbo.domain.date(jstdate);
        system.out.println(jstdate);
        system.out.println(currentjudate);
        system.out.println(new java.util.date(currentojddate.timestampvalue().gettime()));
        system.out.println(currentojddate);
        system.out.println("get1time" + jstdate.gettime() + "\nget2time" +
                           currentjudate.gettime() + "\nget3time" +
                           currentojddate.timestampvalue().gettime());


        try {
            java.util.date judate = df.parse(time);
            system.out.println("judate" + judate);
            oracle.jbo.domain.date ojddate =
                new oracle.jbo.domain.date(new java.sql.timestamp(judate.gettime()));
            system.out.println(ojddate);
            system.out.println("judate.gettime()=" + judate.gettime());
            java.util.date judate2 =
                new java.util.date(ojddate.timestampvalue().gettime());
            system.out.println("ojddate.timestampvalue().gettime()" +
                               ojddate.timestampvalue().gettime());
            system.out.println(judate2);
            string time2 = null;
            time2 = df.format(judate2);
            system.out.println(time2);
        } catch (exception e) {
            system.out.println("exception");
            e.printstacktrace();
        }
    }
(0)
上一篇 2022年3月22日
下一篇 2022年3月22日

相关推荐