In some scenario you might have come across to fetch record with in some date time range. Here I am sharing some code for this. Suppose I am querying records from Minutes Object. There is two field Start_Time and End_Time present in Minutes Object. This is my page <apex:inputField value="{!minute.Start_Time__c}" required="true" label="From Date"/> <apex:inputField value="{!minuteObj.End_Time__c}" required="true" label="To Date"/> <apex:commandButton action="{!convertValidMinutesToUsage}" value="Process Minute's"/> This is my controller public with sharing class ControllerValidMinutesToUsage { public Minute__c minute{get;set;} DateTime startDate; DateTime endDate; string query; public ControllerValidMinutesToUsage(){ minute = new Minute__c(); } ...
A place where you have to land for exploring Salesforce