日期和时间解析 [英] Date and Time Parsing

查看:71
本文介绍了日期和时间解析的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在处理一个平面文件,我得到的日期是->20121210,时间是->124040,我怎么解析这个并作为时间戳插入到数据库中,我正在使用java和pl/sql?

I am processing a flat file,I am getting date as something like->20121210 and time as like->124040,How come I parse this and insert into database as timestamp,I am using java and pl/sql ?

推荐答案

SimpleDateFormat format = new SimpleDateFormat("yyyyMMdd'T'HHmmSS");
String fromFileDateTime = "20121210"+"T"+"124040";
Date date = format.parse(fromFileDateTime );

通过组合从平面文件中获得的日期、时间字符串来填充 fromFileDateTime 变量.

populate fromFileDateTime variable by combining Date,Time strings you obtained from flat file.

这篇关于日期和时间解析的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆