java - Trying to save current date permentently -


simpledateformat sdf = new simpledateformat("dd/mm/yyyy hh:mm"); date = new date(); string strdate = sdf.format(now); 

i trying display current date permanently.

i have tried:

date = new date(); string strdate = sdf.format(now); 

but returning error

since have not posted error, , looking @ code looks fine, best guess getting following error:

error: no suitable constructor found date()  date = new date(); constructor date.date(long) not applicable (actual , formal argument lists differ in length) constructor date.date(int,int,int) not applicable (actual , formal argument lists differ in length) 1 error 

which happens when use java.sql.date instead of java.util.date, since simpledateformat.format() accepts parameter of type java.util.date .

change import statement import java.util.date

or worst case, have not added imports add following:

import java.util.date import java.text.simpledateformat 

Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -