Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Create a simple Java program CurrentDateTime.java to print the current date and time.
- import java.time.LocalDateTime;
- import java.util.Locale;
- public class _05_PrintTheCurrentDateAndTime {
- public static void main(String[] args) {
- // TODO Auto-generated method stub
- Locale.setDefault(Locale.ROOT);
- LocalDateTime thisDateTime = LocalDateTime.now();
- System.out.printf("The Time and Date now is: %1$tH:%1$tM at %1$td/%1$tb/%1$tY.\n",
- thisDateTime);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement