Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- String ts = "120918 10:35:45";
- SimpleDateFormat dateFormat = new SimpleDateFormat("yyMMdd hh:mm:ss");
- java.util.Date parsedDate = dateFormat.parse(ts);
- //parsing timestamp
- Timestamp timestamp = new java.sql.Timestamp(parsedDate.getTime());
- System.out.println("timestamp after parsing :: "+timestamp);
- SimpleDateFormat noMilliSecondsFormatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
- System.out.println(noMilliSecondsFormatter.format(timestamp));
Add Comment
Please, Sign In to add comment