Skip to main content

Parse a weird Date

Please note these forums are being decommissioned and use the new and improved forums at
No replies
Joined: 2014-07-02

I tried to parse String date value, but the date is uncommon:

Here a part of my code

<p>import java.text.ParseException;<br />
import java.text.SimpleDateFormat;<br />
import java.util.Date;</p>
<p>public class Parsing {</p>
<p>	String dateString="Jun 27 21:06:58 2014";<br />
	SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd  HH:mm:ss");</p>
<p>	public void parseDate()throws ParseException{<br />
		Date date1=sdf.parse(dateString);	</p>
<p>		System.out.println(""+date1);<br />
<p>	public static void main(String[] args) {</p>
<p>		Parsing parsing=new Parsing();<br />
		try {<br />
			parsing.parseDate();<br />
		} catch (ParseException e) {<br />
			// TODO Auto-generated catch block<br />
			e.printStackTrace();<br />
<p>	}</p>