Skip to content

Instantly share code, notes, and snippets.

@jihao
Forked from haizhe-cto/DateFormat in java
Created January 4, 2012 15:09
Show Gist options
  • Save jihao/1560446 to your computer and use it in GitHub Desktop.
Save jihao/1560446 to your computer and use it in GitHub Desktop.
DateFormat in java
public static void main(String[] args) throws IOException, ParseException {
String strDate = "2011-01-12 07:50:00";
DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Date date = formatter.parse(strDate);
System.out.println("Date="+date);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment