Skip to content

Instantly share code, notes, and snippets.

@AnnaBoro
Last active January 4, 2016 21:10
Show Gist options
  • Save AnnaBoro/043a03ca8604a1ce45d2 to your computer and use it in GitHub Desktop.
Save AnnaBoro/043a03ca8604a1ce45d2 to your computer and use it in GitHub Desktop.
Calendar + SimpleDateFormat
package lesson5_8;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.GregorianCalendar;
import java.util.Locale;
public class MyBirthday {
public static void main(String[] args) {
GregorianCalendar d = new GregorianCalendar();
d.set(1982, 03, 23);
Date date = new Date(d.getTimeInMillis());
SimpleDateFormat sdf = new SimpleDateFormat("dd MMM yyyy", Locale.ENGLISH);
System.out.println("Birthday: " + sdf.format(date));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment