If only someone could help
All code(s) below gives me a current date,
but I also need to get tomorrows and yesterdays dates.
I think I canīt use simpledateformat because I need to import import java.sql.*;??????
So if anyone can tell me how to modify some of the codes below, It would be great. All I need is that I get forexample yesterdays or tomorrows date with the
"codes" below:
these are the codes what I have try to use without success(they all give me current date)
1.
2.Code:java.sql.Date date = new java.sql.Date((new GregorianCalendar()).getTime().getTime()); jTextField2.setText(""+date);
3.Code:Calendar cal = GregorianCalendar.getInstance(); DateFormat fmt = DateFormat.getInstance(); String buf = fmt.format(cal.getTime()); jTextField2.setText(""+buf);Code:java.util.Date today = new java.util.Date(); java.sql.Date sqlToday = new java.sql.Date(today.getTime()+1); jTextField2.setText(""+sqlToday);



Reply With Quote



Bookmarks