- 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
Maruthi Krishna has Published 951 Articles
![Maruthi Krishna](https://www.tutorialspoint.com/assets/profiles/119958/profile/60_3780337-1641548568.png)
Maruthi Krishna
4K+ Views
In general, the elapsed time is the time from the starting point to ending point of an event. Following are various ways to find elapsed time in Java −Using the currentTimeMillis() methodThe currentTimeMillis() method returns the current time in milliseconds. To find the elapsed time for a method you can ... Read More
![Maruthi Krishna](https://www.tutorialspoint.com/assets/profiles/119958/profile/60_3780337-1641548568.png)
Maruthi Krishna
213 Views
The printf() method is used to print a formatted string, it accepts a string representing a format string and an array of objects representing the elements that are to be in the resultant string, if the number of arguments are more than the number of characters in the format string ... Read More
![Maruthi Krishna](https://www.tutorialspoint.com/assets/profiles/119958/profile/60_3780337-1641548568.png)
Maruthi Krishna
145 Views
The printf() method is used to print a formatted string, it accepts a string representing a format string and an array of objects representing the elements that are to be in the resultant string, if the number of arguments are more than the number of characters in the format string ... Read More
![Maruthi Krishna](https://www.tutorialspoint.com/assets/profiles/119958/profile/60_3780337-1641548568.png)
Maruthi Krishna
891 Views
The GregorianCalendar class supports standard calendars it supports Julian and Gregorian calendars you can create an object of GregorianCalendar using one of its constructors. Following are various examples demonstrating how to print date using this class −ExampleFollowing example creates GregorianCalander by passing year, month and date values as parameters to ... Read More
![Maruthi Krishna](https://www.tutorialspoint.com/assets/profiles/119958/profile/60_3780337-1641548568.png)
Maruthi Krishna
1K+ Views
You can parse a string containing a data to date value using the following ways −The constructor SimpleDateFormat class accepts a String value representing the desired date format and creates this object. You can parse the date string using the parse() method of this class.The parse() method of the LocalDate class ... Read More
![Maruthi Krishna](https://www.tutorialspoint.com/assets/profiles/119958/profile/60_3780337-1641548568.png)
Maruthi Krishna
117 Views
The format() method of the java.lang.String class accepts a format string and an array of arguments and the string in specified format.ExampleFollowing example formats a date using the format() method −Live Demoimport java.util.Calendar; import java.util.GregorianCalendar; public class Test { public static void main(String args[]){ ... Read More
![Maruthi Krishna](https://www.tutorialspoint.com/assets/profiles/119958/profile/60_3780337-1641548568.png)
Maruthi Krishna
198 Views
The java.text.SimpleDateFormat class is used to format and parse a string to date and date to string.Parsing a date stringOne of the constructors of this class accepts a String value representing the desired date format and creates SimpleDateFormat object. To parse/convert a string as a Date objectInstantiate this class by passing ... Read More
![Maruthi Krishna](https://www.tutorialspoint.com/assets/profiles/119958/profile/60_3780337-1641548568.png)
Maruthi Krishna
131 Views
The java.text.SimpleDateFormat class is used to format and parse a string to date and date to string. To parse a date string −Instantiate this class by passing desired format string.Parse the date string using the parse() method.ExampleLive Demoimport java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; public class Sample { public static void ... Read More
![Maruthi Krishna](https://www.tutorialspoint.com/assets/profiles/119958/profile/60_3780337-1641548568.png)
Maruthi Krishna
358 Views
Using the LocalDate classThe java.time.LocalDate class represents the local date i.e. the date without time zone, you can use this object instead of Date. This class provides various methods such as isBefore(), isAfter() and, isEqual() to compare two dates −ExampleLive Demoimport java.time.LocalDate; public class Sample { public static void main(String ... Read More
![Maruthi Krishna](https://www.tutorialspoint.com/assets/profiles/119958/profile/60_3780337-1641548568.png)
Maruthi Krishna
6K+ Views
The java.text.SimpleDateFormat class is used to format and parse a string to date and date to string.One of the constructors of this class accepts a String value representing the desired date format and creates SimpleDateFormat object. To parse/convert a string as a Date object Instantiate this class by passing desired format string.Parse ... Read More