From b29c8a398a1b549f99b5b00fe970c2d2fc512565 Mon Sep 17 00:00:00 2001 From: Muhammad Waleed Ahmad <115546135+MuhammadWaleed-0786@users.noreply.github.com> Date: Sun, 15 Oct 2023 01:14:47 +0500 Subject: [PATCH] Create SimpleDateFormat.java Create SimpleDateFormat.java --- SimpleDateFormat.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 SimpleDateFormat.java diff --git a/SimpleDateFormat.java b/SimpleDateFormat.java new file mode 100644 index 00000000..02de9834 --- /dev/null +++ b/SimpleDateFormat.java @@ -0,0 +1,12 @@ +import java.text.SimpleDateFormat; +import java.util.Date; + +public class DateFormatExample { + public static void main(String[] args) { + Date currentDate = new Date(); + SimpleDateFormat dateFormat = new SimpleDateFormat("dd-MM-yyyy HH:mm:ss"); + + String formattedDate = dateFormat.format(currentDate); + System.out.println("Current Date and Time: " + formattedDate); + } +}