Skip to content

Instantly share code, notes, and snippets.

@rosuH
Created February 7, 2019 07:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rosuH/5f984132768da6192e804818083357ee to your computer and use it in GitHub Desktop.
Save rosuH/5f984132768da6192e804818083357ee to your computer and use it in GitHub Desktop.
Date Formatter In Java8
import java.util.*;
import java.text.*;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
public class DateDemo {
public static void main(String args[]) {
Date dNow = new Date("Tue, 05 Feb 2019 00:00:00 GMT");
SimpleDateFormat ft =
new SimpleDateFormat ("yyyy-MM-DD", Locale.CHINA);
System.out.println(LocalDate.parse("Tue, 05 Feb 2019 00:00:00 GMT", DateTimeFormatter.RFC_1123_DATE_TIME));
System.out.println("Current Date: " + ft.format(dNow));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment