- Trending Categories
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
Karthikeya Boyini has Published 2383 Articles
![karthikeya Boyini](https://www.tutorialspoint.com/assets/profiles/13518/profile/60_31598-1537784993.jpg)
karthikeya Boyini
3K+ Views
Use the SimpleDateFormat class to display time in 24-hour format.Set the formatDate dt = new Date(); SimpleDateFormat dateFormat; dateFormat = new SimpleDateFormat("kk:mm:ss");Now, the following will display time in 24-hour formatdateFormat.format(dt)The following is an exampleExample Live Demoimport java.text.SimpleDateFormat; import java.util.Date; public class Demo { public static void main(String[] argv) throws Exception ... Read More
![karthikeya Boyini](https://www.tutorialspoint.com/assets/profiles/13518/profile/60_31598-1537784993.jpg)
karthikeya Boyini
3K+ Views
DateFormat.SHORT is a constant for short style pattern.Firstly, we will create date objectDate dt = new Date(); DateFormat dateFormat;Let us format date for different locale with DateFormat.SHORT// FRENCH dateFormat = DateFormat.getDateInstance(DateFormat.SHORT, Locale.FRENCH); // GERMANY dateFormat = DateFormat.getDateInstance(DateFormat.SHORT, Locale.GERMANY);The following is an example −Example Live Demoimport java.text.DateFormat; import java.util.Date; import java.util.Locale; public ... Read More
![karthikeya Boyini](https://www.tutorialspoint.com/assets/profiles/13518/profile/60_31598-1537784993.jpg)
karthikeya Boyini
384 Views
Use the getTimeInstance() method in Java to get the time format for the locale you have set. DateFormat.SHORT is a constant for short style pattern.Firstly, we will create Date objectDate dt = new Date(); DateFormat dateFormat;Let us format time for different locale with DateFormat.SHORTdateFormat = DateFormat.getTimeInstance(DateFormat.SHORT, Locale.CHINESE); System.out.println("Locale CHINESE = ... Read More
![karthikeya Boyini](https://www.tutorialspoint.com/assets/profiles/13518/profile/60_31598-1537784993.jpg)
karthikeya Boyini
89 Views
The Float.isInfinite() method in Java returns true if this Float value is infinitely large in magnitude, else false is returned.We have the following Float valuesFloat f1 = new Float(5.0/0.0); Float f2 = new Float(10.2/0.0); Float f3 = new Float(0.0/0.0);Check with isInfinite() methodf1.isInfinite(); f2.isInfinite(); f3.isInfinite();The following is the complete example with ... Read More
![karthikeya Boyini](https://www.tutorialspoint.com/assets/profiles/13518/profile/60_31598-1537784993.jpg)
karthikeya Boyini
147 Views
Use the getTimeInstance() method in Java to get the time format for the locale you have set. DateFormat.LONG is a constant for long style pattern.Firstly, we will create Date objectDate dt = new Date(); DateFormat dateFormat;Let us format time for different locale with DateFormat.LONGdateFormat = DateFormat.getTimeInstance(DateFormat.LONG, Locale.FRENCH); System.out.println("Locale FRENCH = ... Read More
![karthikeya Boyini](https://www.tutorialspoint.com/assets/profiles/13518/profile/60_31598-1537784993.jpg)
karthikeya Boyini
348 Views
To format date, let us see the DateFormat.SHORT as well as DateFormat.LONG constants. Both of them displays different patterns.Here, we are formatting dates with getDateTimeInstance() method. Use the method to get a date and time format.For DateFormat.SHORT constant −DateFormat dateFormat = DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT); System.out.println(dateFormat.format(calendar.getTime()));For DateFormat.LONG constant −dateFormat = DateFormat.getDateTimeInstance(DateFormat.LONG, DateFormat.LONG); ... Read More
![karthikeya Boyini](https://www.tutorialspoint.com/assets/profiles/13518/profile/60_31598-1537784993.jpg)
karthikeya Boyini
316 Views
In Java, you can parse string date time value input usingSimpleDateFormat("E, dd MMM yyyy HH:mm:ss Z");We have used the above class since we imported the following package −import java.text.SimpleDateFormat;Now, we can display the date in the same format −Date dt = (Date) dateFormatter.parseObject("Tue, 20 Nov 2018 16:10:45 -0530");The following is ... Read More
![karthikeya Boyini](https://www.tutorialspoint.com/assets/profiles/13518/profile/60_31598-1537784993.jpg)
karthikeya Boyini
2K+ Views
Firstly, import the following Java packagesimport java.text.SimpleDateFormat; import java.util.Date;Now, create objectsDate dt = new Date(); SimpleDateFormat dateFormat;Displaying date in the format we want −dateFormat = new SimpleDateFormat("dd MMM yyyy hh:mm:ss zzz");The following is an example −Example Live Demoimport java.text.SimpleDateFormat; import java.util.Date; public class Demo { public static void main(String args[]) ... Read More
![karthikeya Boyini](https://www.tutorialspoint.com/assets/profiles/13518/profile/60_31598-1537784993.jpg)
karthikeya Boyini
123 Views
To set a duration, let us declare two objects of Calendar classCalendar c1 = Calendar.getInstance(); Calendar c2 = Calendar.getInstance();Set a time for one of the calendar objectsc2.add(Calendar.HOUR, 9); c2.add(Calendar.MINUTE, 15); c2.add(Calendar.SECOND, 40);Now, find the difference between both the time. One would be the current time and another we declared above ... Read More
![karthikeya Boyini](https://www.tutorialspoint.com/assets/profiles/13518/profile/60_31598-1537784993.jpg)
karthikeya Boyini
175 Views
To create hinge animation effect with CSS, you can try to run the following code:ExampleLive Demo .animated { background-image: url(/css/images/logo.png); background-repeat: no-repeat; ... Read More