This example is for Java beginners to learn use of Java Date Format.
-Watch video
https://youtu.be/sX0XAROhuiQ
import java.util.Date;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
public class Main {
public Main() {
}
public static void main(String[] args) {
Date today = new Date();
DateFormat df=new SimpleDateFormat("dd-MMM-yyyy HH:mm:ss");
java.sql.Date date=new java.sql.Date(today.getTime());
System.out.println(df.format(date));
}
}
Watch video
No comments:
Post a Comment