You need to sign in to do that
Don't have an account?

Date
Hi
Tell me how to find out the month from date.
I have done like this
public datetime takemonth; public PageReference month() { // date duedate = date.today(); date dueDue = Date.newInstance(takemonth.year(),takemonth.month()); // integer dueNow = duedate.month(dueDate); system.debug('++++++++++++++++++++++++'+ dueDue ); return dueDue ; }
And i am getting the error
Error: ctrl_sch Compile Error: Method does not exist or incorrect signature: Date.newInstance(Integer, Integer) at line 30 column 22
thanks
Anuraj
Hi,
Use the below code.
date duedate = date.today();
Integer month=duedate.month();
System.debug('Month is -->'+month);
Thanks,
MVP
All Answers
Hi,
Use the below code.
date duedate = date.today();
Integer month=duedate.month();
System.debug('Month is -->'+month);
Thanks,
MVP
you are getting this error because your syntax for creating date is not correct.
Date Duedue = Date.newInstance(takemonth.year(),takemonth.month(),takemonth.day());
integer month = Duedue.month();
However it's bit weird coz takemonth.month() will give you month as an integer if takemonth is a date object, can you tell what is takemonth? and what value it holds?