String类型和Timestamp类型相互转化
2010-05-29 10:52
330 查看
Timestamp转化为String:
String转化为Timestamp:
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");//定义格式 Timestamp now = new Timestamp(System.currentTimeMillis());//获取系统当前时间 String str = df.format(now);
String转化为Timestamp:
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); String time = df.format(new Date()); Timestamp ts = Timestamp.valueOf(time);
相关文章推荐
- java中String类型和char[]类型的相互转化
- Int类型与String类型之间的相互转化
- String与int类型相互转化
- date日期类型与String类型的相互转化
- String,Timestamp,Date(java.util.date,java,sql.date)相互转化
- C++ 中 string 和其它类型的相互转化。
- C# string类型和Byte[]相互转化
- Java基础知识强化59:String(字符串)和其他类型的相互转化
- Timestamp 相互转化 String
- C++ int与string类型相互转化
- date日期类型与String类型的相互转化
- 4000 Java日期格式转化工具(date格式转为string格式,string转date,string转timestamp类型)
- Date、String、Calendar、Timestamp类型之间的转化
- Date和String类型相互转化
- Flex中Date类型与String类型相互转化
- Map的遍历方法及String和其它类型的相互转化
- Date与String类型相互转化
- date日期类型与String类型的相互转化
- string与date与Timestamp相互转化…
- java:String类型与char类型相互转化