-5

I have date from the below

String strFrstWeekRefDate = WebElement.get(iCount)
              .findElement(By.tagName("span")).getAttribute("ref");

where ref contains the date in 2013-06-05 00:00:00 format. I need to change to mm/dd/yyyy using a method so i can call this method whenever its needed.

TecHunter
  • 6,091
  • 2
  • 30
  • 47
sunil
  • 21
  • http://stackoverflow.com/questions/9872419/converting-string-to-date-using-simpledateformat – AurA Jun 12 '13 at 12:51
  • 1
    When you entered the question's title in [ask question](http://stackoverflow.com/questions/ask) form, you was been presented a list of "related questions" (which is exactly the same list as appears below on the right hand column here), the 1st question already contains the answer. Why didn't you bother to look in there? – BalusC Jun 12 '13 at 12:51

1 Answers1

0

try this.

String dateFormat = "MM/dd/yyyy";
SimpleDateFormat sdf =new SimpleDateFormat(dateFormat, new Locale("en_US"));
Date date = new Date();
System.out.println(sdf.format(date));
AurA
  • 12,135
  • 7
  • 46
  • 63
KhAn SaAb
  • 5,248
  • 5
  • 31
  • 52