In Java we constantly need to format date and time. so for that we can use the class SimpleDateFormat. So i will show how to get a Date instance and format it.
Calendar calendar = Calendar.getInstance();
Date date = calendar.getTime();
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
String outputString = formatter.format(date)
Calendar calendar = Calendar.getInstance();
Date date = calendar.getTime();
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
String outputString = formatter.format(date)
0 comments:
Post a Comment