Skip to content

Instantly share code, notes, and snippets.

@victorvaz
Created March 14, 2016 15:08
Show Gist options
  • Save victorvaz/01f8ef88c58249fd1dc4 to your computer and use it in GitHub Desktop.
Save victorvaz/01f8ef88c58249fd1dc4 to your computer and use it in GitHub Desktop.
package datanojava;
import java.text.SimpleDateFormat;
import java.util.Date;
public class FormatarSimpleDateFormat {
public static void main (String[] args) {
Date data = new Date();
System.out.println(data); // Mon Mar 14 12:06:56 BRT 2016
SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss");
System.out.println(sdf.format(data)); // 14/03/2016 12:06:56
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment