I am reading in two fields from a database, both are strings. The first string is in the format yyyymmdd(year month day) ex 20060801. The second is hhmmss(hours minutes seconds) ex. 231127. I have an object that takes a Timestamp as an argumnet to its constructor. I need to somehow manipulate these two strings into a time stamp so I can pass them to the other object. I looked at Timestamp and it looks like the deprecated way is to flat out parse both strings into the individual parts and pass them into the Timestamps constructor. I saw the new way is to pass the mili seconds into the Timestamps constructor. Any thoughts on how I can do this?
If you just store yyyymmdd why do you need timestamp? Why Date objects aren't sufficient. Anyway the answer to your question is you need to parse the String value into date object using SimpleDateFormat and then get the long value of the date object and pass it as arg to Timestamp constructor.
Joined: Sep 24, 2005
Ok so what do I do with the hhmmss string. How do I properly add that to the milis that I will be getting from the yyyymmdd string?