public SearchStudent(){ DateTime dt = System.Now().addHours(-1); stu = [SELECT Id,Name, Phone,LastModifiedDate FROM Student where LastModifiedDate=:dt ORDER BY LastModifiedDate DESC LIMIT 1]; system.debug('stu'+stu);
Please help the community to understand the requirement. Do we need to display all the records which were modified after some date. Can you elobrate what is meant by recently here.
public SearchStudent(){ DateTime dt = System.Now().addHours(-1); stu = [SELECT Id,Name, Phone,LastModifiedDate FROM Student where LastModifiedDate=:dt ORDER BY LastModifiedDate DESC LIMIT 1]; system.debug('stu'+stu);
Please try this code:
Vf Page:
<apex:page controller="SearchStudent">
<apex:form >
<apex:pageblock title="Recently Modified student">
<apex:pageBlockTable value="{!stu}" var="c">
<apex:column value="{!c.Name}"/>
</apex:pageBlockTable>
</apex:pageblock>
</apex:form>
</apex:page>
Apex class:
public class SearchStudent {
public List<Student> stu {get;set;}
public SearchStudent(){
DateTime dt = System.Now().addHours(-1);
stu = [SELECT Id,Name, Phone,LastModifiedDate FROM Student where LastModifiedDate=:dt ORDER BY LastModifiedDate DESC LIMIT 1];
system.debug('stu'+stu);
}
}
Hope this will help you.
Thanks.
All Answers
Please help the community to understand the requirement. Do we need to display all the records which were modified after some date. Can you elobrate what is meant by recently here.
Thanks,
Please try this code:
Vf Page:
<apex:page controller="SearchStudent">
<apex:form >
<apex:pageblock title="Recently Modified student">
<apex:pageBlockTable value="{!stu}" var="c">
<apex:column value="{!c.Name}"/>
</apex:pageBlockTable>
</apex:pageblock>
</apex:form>
</apex:page>
Apex class:
public class SearchStudent {
public List<Student> stu {get;set;}
public SearchStudent(){
DateTime dt = System.Now().addHours(-1);
stu = [SELECT Id,Name, Phone,LastModifiedDate FROM Student where LastModifiedDate=:dt ORDER BY LastModifiedDate DESC LIMIT 1];
system.debug('stu'+stu);
}
}
Hope this will help you.
Thanks.