Skip to content

Instantly share code, notes, and snippets.

@infinitecontext
Created February 10, 2020 19:29
Show Gist options
  • Select an option

  • Save infinitecontext/4aa0ea0084f83ca3cbf2da134dee05d3 to your computer and use it in GitHub Desktop.

Select an option

Save infinitecontext/4aa0ea0084f83ca3cbf2da134dee05d3 to your computer and use it in GitHub Desktop.
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
class App {
public static void main(String[] args) {
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-mm-dd");
LocalDateTime now = LocalDateTime.now();
System.out.println("current date: " + formatter.format(now));
formatter = DateTimeFormatter.ofPattern("hh:mm:ss.msmsms");
System.out.println("current date: " + formatter.format(now));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment