• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 207
  • Last Modified:

store values from <List> String to <List> Date

how to assign values from  <List> String  to <List> Date. The data in the String has a format of "dd/MM/yyyy".
0
Yap_YokeWan
Asked:
Yap_YokeWan
2 Solutions
 
objectsCommented:
Use a DateFormatto convert the string, http://www.objects.com.au/java/qa/1404517384.html

Something like:

DateFormat df = new SimpleDateFormat("dd/MM/yyyy");
for (String date : dateStrings)
{
   dates.add(df.parse(date));
}
0
 
sciuriwareCommented:
Use SimpleDateFormat with the pattern you specified.
You must program a loop to transfer the values one by one.

;JOOP!
0
 
Yap_YokeWanAuthor Commented:
i retrieve the list of data (date type) and store into <List> String. I only want the list of dates that is more than the passed in value which is a String type having the date format as "dd/MM/YYYY"
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
VenabiliCommented:
Yap_YokeWan,

objects is showing exactly this:
dateStrings is the list with the List <String>, dates is List <Date>
And do not forget to initialise dates :)
What you do not understand?

PS: NO points for me.
0
 
ksivananthCommented:
>>I do not know why you decided to post a program which implements what the experts were telling above and is adding NOTHING new to the real question.
>>

the earlier posts weren't there when I posted! could be a refresh problem... and I am seeing this kind of posts very usual... See sciuriware's post which describes exactly what Object posted!

>>Except that it contained all the goodies so that the Asker can just copy-paste without even think...

Thats an example I had in my harddisk and I don't think that is no more different from pointing a link which has the implementations like that!!!

>>Additionally you somehow missed even to mention that this is what was already said.

See my comment earlier!

IT"S ANNOYING SEEING A VALID POST DELETED :(
0
 
objectsCommented:
> I only want the list of dates that is more than the passed in value which is a String type having the date format as "dd/MM/YYYY"

then filter inside the loop

   Date d = df.parse(date);
   if (d.after(testDate))
   {
      dates.add(d);
   }
0
 
ksivananthCommented:
>>Your comment was almost 2 and a half HOURS after the first two.

it could be becuase I don't know when I had opened that question, when I returned back I saw the questioned opened and then posted mine!

>>Are you saying that you did not see the above after you posted as well?

I could have seen them if I waited for the rendering happen after the post!

>>Your comment was a fully blown program which adds nothing to the real problem solution compared to the already posted ones. The link shows only how to make the conversion (which is the question)
>>

I am just participating in forums when I get times. I don't want to argue any more... just leave it!

Thanks!
0
 
Computer101Commented:
Forced accept.

Computer101
EE Admin
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now