You need to sign in to do that
Don't have an account?
sp13
query dateTime to date
how can i get the Date value of a DateTime field in query?
unfortunately, DATEVALUE(field) didn't work. is there anyway i can get the date value of Date_Time__c?
public Date myDate1 {get;set;}
public Date myDate2 {get;set;}
public List<Obj__c> getObj() {
return[SELECT id, Name, Date_Time__c FROM Obj__c WHERE DATEVALUE(Date_Time__c) <=: myDate1 and DATEVALUE(Date_Time__c) >=: myDate2];
}
public Date myDate2 {get;set;}
public List<Obj__c> getObj() {
return[SELECT id, Name, Date_Time__c FROM Obj__c WHERE DATEVALUE(Date_Time__c) <=: myDate1 and DATEVALUE(Date_Time__c) >=: myDate2];
}
unfortunately, DATEVALUE(field) didn't work. is there anyway i can get the date value of Date_Time__c?
I am not sure about DATEVALUE() function..but i think you can try by creating a formula field, containing the date value of the date_Time__c, and use that field in the query.
Thanks,
Suresh
All Answers
What is the data type date_time__c? If it is dateTime then datvalue should work.
I am not sure about DATEVALUE() function..but i think you can try by creating a formula field, containing the date value of the date_Time__c, and use that field in the query.
Thanks,
Suresh