
can we change the format of date like sql as per our requirements???If yes then please give the detail solution.

Using SimpleDateFormat class, you can change the format of date.
Here is an example:
import java.util.*;
import java.text.*;
class DateExample
{
public static void main(String[] args)
{
Date date=new Date();
String formats[]={"dd-MM-yyyy","d MMM yyyy","dd/MM/yyyy","EEE, MMM d,yyyy","dd-MM-yyyy HH:mm:ss"};
for(int i=0;i<formats.length;i++){
SimpleDateFormat sdf=new SimpleDateFormat(formats[i]);
String d=sdf.format(date);
System.out.println(d);
}
}
}
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.