JAVA获取数据库TIMESTAMP(6) WITH LOCAL TIME ZONE
2017-02-14 09:25
471 查看
数据库中TIMESTAMP有时区的概念,因此java当中按照date的获取方式来获取TIMESTAMP是不可行的。以下提
供两种方法:
第一种:java中转换
第二种:数据库中转换查询,直接用string接收
select to_char(i.blockon, 'IYYY-MM-DD HH24:MI:SS') from its i
供两种方法:
第一种:java中转换
Object obj = rs.getObject(1); TIMESTAMP t = (TIMESTAMP)obj; Timestamp tt; tt = t.timestampValue(); Date date = new Date(tt.getTime()); SimpleDateFormat sd = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss"); System.out.println(sd.format(date));
第二种:数据库中转换查询,直接用string接收
select to_char(i.blockon, 'IYYY-MM-DD HH24:MI:SS') from its i
相关文章推荐
- Oracle中的 timestamp 和 timestamp with time zone, timestamp with local time zone
- [每日一题] OCP1z0-047 :2013-08-26 TIMESTAMP WITH LOCAL TIME ZONE....................112
- timestamp with local time zone 和 timesatamp with time zone的区别
- TIMESTAMP WITH TIME ZONE &TIMESTAMP WITH LOCAL TIME ZONE
- timestamp with local time zone类型和timestamp with time zone
- ocp-047-30 timestamp with local time zone 和timesatamp with time zone
- timestamp with time zone 和 timestamp with local time zone
- timestamp with local time zone类型和timestamp with time zone
- TIMESTAMP WITH TIME ZONE与TIMESTAMP WITH LOCAL TIME ZONE数据类型
- Java获取数据库TimeStamp类型时间代码
- Simple trick to convert Date format with timezone in Java!
- MySQL连接数据库报时区错误:java.sql.SQLException: The server time zone value
- 探索 Java 中的 Date Calendar TimeZone 和Timestamp
- ORA-30078: partition bound must be TIME/TIMESTAMP WITH TIME ZONE literals
- Oracle TIMESTAMP WITH TIME ZONE类型
- INTERVAL YEAR TO MONTH和TIMESTAMP WITH TIME ZONE 等
- Java获取系统时间Timestamp类型系统时间
- 【软件自动化测试-QTP实战技能 17】== QTP_Compare local sheet values with run time data table values
- Tips for working with time zone in flex app
- Java获取网络文件并插入数据库