• tejaswini
  • NEWBIE
  • 0 Points
  • Member since 2012

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 0
    Replies

when i insert dates in 2 fields,it should display all the records/names created  between that dates. but what have given the query ,it is accepting that dates, manually if i enter in date fields its not accepting, i know something error in query,it would be great if anyone help in this issue?

 

<apex:page controller="MyController1">
<apex:form >
<apex:pageBlock title="Date Fields">
<apex:pageBlockSection >
<apex:inputText value="{!acc1.dj__c}"/>
<apex:inputText value="{!acc1.releaving_date__c}"/>
<apex:commandButton action="{!go}" value="go" immediate="false"/>
<apex:dataList value="{!acc}" var="acc1" >
{!acc1.name}
</apex:dataList>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>

////////////////////////////////controller////////////////////

public class MyController1
{
public Task DateInput {get;set;}
public LIST<hods__c> acc{get; set;}
public hods__c acc1{get; set;}

public MyController1()
{
DateInput = new Task();
acc = new LIST<hods__c>();
acc1 = new hods__c();
}

public void go()
{
acc=[Select name from hods__c where dj__c = LAST_N_YEARS:2 and releaving_date__c <= TODAY ];

system.debug('11111111111111111'+ acc);
}
}