You need to sign in to do that
Don't have an account?
Aman
query BirthDate in SOQL
I have two <apex:inputText> tags on VF pages which receives Birthdate and have Jquery Datepicker.
<apex:inputText value="{!BirthDate}"/>
and
<apex:inputText value="{!BirthDateTo}"/>
When user select date in both fields.
I want to pick results through SOQL in from range.
like.
select id from object__c where dob>= birthdate and dob<=birthdateto
But the date type of dob in object is of type Text instead of Date.
Is anyone help me to how to query the data in range if i have the datatype of dob in text.
Please help me.
Modify the dob field datatype on the object__c to DateTime or Date
We can not change our data type from tex to datetime or date.
what is max no.of records the object__c can have?
Can you use the Date.parse(String) method?
http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_methods_system_date.htm
Cheers,
Date.parse(String) does not work in this scenario... you can give it a try...
If i use Date.parse(String) it converts string to date but when i use that date in our dynamic query
my date type is of type text and and on other hand my input is in the form of date.
force.com shows error
and i have near about 500 records and displaying it through pagination.
what is the total no.of records in the objec__c?
near about 500
then you can do the following
1)query all the 500 records in to a list
2) for each record
{
//check if the date.parse(string date field on record) satisfies your criteria
}
3)if it satisfies add it to a new list else ignore it.
now you have all the records satisfying your criteria in a new list. return this new list to the vf page.