![Trending Articles on Technical and Non Technical topics](/images/trending_categories.jpeg)
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 9326 Articles for Object Oriented Programming
![karthikeya Boyini](https://www.tutorialspoint.com/assets/profiles/13518/profile/60_31598-1537784993.jpg)
196 Views
E format is used in Java Date to format day of week like Mon, Tue, Wed, etc. Let us use it.// displaying day of week SimpleDateFormat simpleformat = new SimpleDateFormat("E"); String strDayofWeek = simpleformat.format(new Date()); System.out.println("Day of Week = "+strDayofWeek);Above, we have used the SimpleDateFormat class, therefore the following package is imported −import java.text.SimpleDateFormat;The following is an example −Example Live Demoimport java.text.Format; import java.text.SimpleDateFormat; import java.util.Date; import java.util.Calendar; public class Demo { public static void main(String[] args) throws Exception { // displaying current date and time ... Read More
![Samual Sam](https://www.tutorialspoint.com/assets/profiles/13514/profile/60_83486-1512649303.jpg)
6K+ Views
Let us format date in mm-dd-yyyy hh:mm:ss format −// displaying date in mm-dd-yyyy hh:mm:ss format Format f = new SimpleDateFormat("mm-dd-yyyy hh:mm:ss"); String str = f.format(new Date()); System.out.println("Current Date in MM-dd-yyyy hh:mm:ss format = "+str);Since we have used the Format and SimpleDateFormat class above, therefore import the following packages. With that, we have also used the Date −import java.text.Format; import java.text.SimpleDateFormat; import java.util.Date;The following is an example −Example Live Demoimport java.text.Format; import java.text.SimpleDateFormat; import java.util.Date; import java.util.Calendar; public class Demo { public static void main(String[] args) throws Exception { // displaying current date ... Read More
![karthikeya Boyini](https://www.tutorialspoint.com/assets/profiles/13518/profile/60_31598-1537784993.jpg)
3K+ Views
Using the SimpleDateFormat(“MMM”) to display three-letter month −Format f = new SimpleDateFormat("MMM"); String strMonth = f.format(new Date()); System.out.println("Month (Three-letter format) = "+strMonth);Since, we have used the Format and SimpleDateFormat class above, therefore import the following packages. With that, we have also used the Date −import java.text.Format; import java.text.SimpleDateFormat; import java.util.Date;The following is an example −Example Live Demoimport java.text.Format; import java.text.SimpleDateFormat; import java.util.Date; import java.util.Calendar; public class Demo { public static void main(String[] args) throws Exception { // displaying current date and time Calendar cal = Calendar.getInstance(); SimpleDateFormat simpleformat = new SimpleDateFormat("E, ... Read More
![Samual Sam](https://www.tutorialspoint.com/assets/profiles/13514/profile/60_83486-1512649303.jpg)
409 Views
Using the SimpleDateFormat(“yyyy”) to display year −// displaying year Format f = new SimpleDateFormat("yyyy"); String strYear = f.format(new Date()); System.out.println("Year = "+strYear);Since, we have used the Format and SimpleDateFormat class above, therefore import the following packages. With that, we have also used the Date −import java.text.Format; import java.text.SimpleDateFormat; import java.util.Date;The following is an example −Example Live Demoimport java.text.Format; import java.text.SimpleDateFormat; import java.util.Date; import java.util.Calendar; public class Demo { public static void main(String[] args) throws Exception { // displaying current date and time Calendar cal = Calendar.getInstance(); SimpleDateFormat simpleformat = new SimpleDateFormat("E, ... Read More
![karthikeya Boyini](https://www.tutorialspoint.com/assets/profiles/13518/profile/60_31598-1537784993.jpg)
4K+ Views
Using the SimpleDateFormat(“E, dd MMM yyyy HH:mm:ss Z”), wherein E is for Day of Week −// displaying current date and time Calendar cal = Calendar.getInstance(); SimpleDateFormat simpleformat = new SimpleDateFormat("E, dd MMM yyyy HH:mm:ss Z"); System.out.println("Today's date and time = "+simpleformat.format(cal.getTime()));Since we have used the Format and SimpleDateFormat class above, therefore import the following packages. With that, we have also used the Date −import java.text.Format; import java.text.SimpleDateFormat; import java.util.Date;The following is an example −Example Live Demoimport java.text.Format; import java.text.SimpleDateFormat; import java.util.Date; import java.util.Calendar; public class Demo { public static void main(String[] args) throws Exception { ... Read More
![Samual Sam](https://www.tutorialspoint.com/assets/profiles/13514/profile/60_83486-1512649303.jpg)
161 Views
To display the day number, use the SimpleDateFormat('d') as shown below −Format f = new SimpleDateFormat("d"); String strDay = f.format(new Date()); System.out.println("Day Number = "+strDay);Since, we have used the Format and SimpleDateFormat class above, therefore import the following packages. With that, we have also used the Date −import java.text.Format; import java.text.SimpleDateFormat; import java.util.Date;The following is an example −Example Live Demoimport java.text.Format; import java.text.SimpleDateFormat; import java.util.Date; import java.util.Calendar; public class Demo { public static void main(String[] args) throws Exception { // displaying current date and time Calendar ... Read More
![karthikeya Boyini](https://www.tutorialspoint.com/assets/profiles/13518/profile/60_31598-1537784993.jpg)
2K+ Views
The Z means "zero hour offset", also known as "Zulu time" (UTC) in the ISO 8601 time representation. However, ACP 121 standard defines the list of military time zones and derives the "Zulu time" from theGreenwich Mean Time (GMT).Let us see the usage of SimpleDateFormat(“HH:mm:ss Z”) −Format f = new SimpleDateFormat("HH.mm.ss Z"); String strResult = f.format(new Date()); System.out.println("Time = "+strResult);The following is the complete example that displays time with offset (HH:mm:ss Z) −Example Live Demoimport java.text.Format; import java.text.SimpleDateFormat; import java.util.Date; import java.util.Calendar; public class Demo { public static void main(String[] args) throws Exception { ... Read More
![Samual Sam](https://www.tutorialspoint.com/assets/profiles/13514/profile/60_83486-1512649303.jpg)
9K+ Views
The format SimpleDateFormat(“HH.mm.ss”) displays time. To work with SimpleDateFormat class, we have imported the following package.import java.text.SimpleDateFormat;Here, we are using the SimpleDateFormat class to display date and time. Let us set it for the format we want i.e time - HH.mm.ss −Format f = new SimpleDateFormat("HH.mm.ss"); String strResult = f.format(new Date()); System.out.println("Time = "+strResult);The following is an example −Example Live Demoimport java.text.Format; import java.text.SimpleDateFormat; import java.util.Date; import java.util.Calendar; public class Demo { public static void main(String[] args) throws Exception { // displaying current date and time ... Read More
![karthikeya Boyini](https://www.tutorialspoint.com/assets/profiles/13518/profile/60_31598-1537784993.jpg)
3K+ Views
The following format displays time from −hh:mm:ssThe following format displays time with AM/ PM marker −hh:mm:ss aHere, we are using the SimpleDateFormat class to display date and time. Let us set it for the format we want i.e time and AM/PM Marker −Format f = new SimpleDateFormat("hh:mm:ss a"); String strResult = f.format(new Date()); System.out.println("Time = "+strResult);The following is an example −Example Live Demoimport java.text.Format; import java.text.SimpleDateFormat; import java.util.Date; import java.util.Calendar; public class Demo { public static void main(String[] args) throws Exception { // displaying current date and time ... Read More
![Samual Sam](https://www.tutorialspoint.com/assets/profiles/13514/profile/60_83486-1512649303.jpg)
5K+ Views
The Z means "zero hour offset", also known as "Zulu time" (UTC) in the ISO 8601 time representation. However, ACP 121 standard defines the list of military time zones and derives the "Zulu time" from the Greenwich Mean Time (GMT).TimeZone can be formatted in z, Z or zzzz formats.The following is an example that displays how to implement SimpleDateFormat(“Z”) −Example Live Demoimport java.text.Format; import java.text.SimpleDateFormat; import java.util.Date; import java.util.Calendar; public class Demo { public static void main(String[] args) throws Exception { // displaying current date and time ... Read More