Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package day4HomeWork;
- import java.time.*;
- import java.time.format.DateTimeFormatter;
- import java.time.format.FormatStyle;
- public class DataTime {
- public static void main(String[] args) {
- LocalDateTime currentDateTime = LocalDateTime.now();
- DateTimeFormatter format1 = DateTimeFormatter.ofPattern("EEEE, dd/MM/yyyy hh:mm a");
- String formatDateTime = currentDateTime.format(format1);
- System.out.println(formatDateTime);
- DateTimeFormatter format2 = DateTimeFormatter.ofPattern("dd-MM-yyyy HH:mm:ss");
- String formatDateTime2 = currentDateTime.format(format2);
- System.out.println(formatDateTime2);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement