Get the today date in string format in Java


Date() in java.utils provide Date instance which contains the date of today. We can showing the day, month, year of today from Date() instance using SimpleDateFormat().format().

Example:

1
String today = new SimpleDateFormat("yyyyMMdd_HH:mm:ss").format(new Date());

Simple!


Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.