Created
February 7, 2019 07:45
-
-
Save rosuH/5f984132768da6192e804818083357ee to your computer and use it in GitHub Desktop.
Date Formatter In Java8
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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