Java Quick Tip of the Day: Getting the Date in YYYYMMDD Format
June 15 3 Comments
There are times when you need to return a date as string in YYYYMMDD format. Here’s a simple way to do it:
import java.text.*; ... ... ... SimpleDateFormat sf = new SimpleDateFormat("yyyyMMdd"); java.util.Date date = java.util.Calendar.getInstance().getTime(); System.out.println(sf.format(date));
Recent Comments