Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
Selected Reading
Get localized day name in Java
The following is an example.
Example
import java.util.Date;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
public class Demo {
public static void main(String[] args) throws Exception {
Date d = new Date();
DateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy hh:mm:ss a");
String format = dateFormat.format(d);
System.out.println("Current date and time = " + format);
System.out.printf("Localized day name = %tA/%TA\n", d, d);
}
}
Output
Current date and time = 26/11/2018 11:44:44 AM Localized day name = Monday/MONDAY
Advertisements
