• Post Reply Bookmark Topic Watch Topic
  • New Topic

Cast string to Date  RSS feed

 
sandeep balyan
Ranch Hand
Posts: 134
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Friends
Iam having a problem.I want to cast string to a date format..pls tell how can I ..
 
JeanLouis Marechaux
Ranch Hand
Posts: 906
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try this.
import java.util.*;
import java.text.*;
SimpleDateFormat sdf = new SimpleDateFormat("MM/dd/yy");
Date date = sdf.parse(myString);
HTH.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!