function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
r1985r1985 

Conversion into string

Hi,

 

How to convert the below query into string??

 

query=[select count() from Account where createddate>:Date.Today()];

 

 

Thanks in advance,

Best Answer chosen by Admin (Salesforce Developers) 
Sarv333Sarv333

I think you are trying to do like this.

 

Date TodayDate =  Date.Today();   

String query= 'select count() from Account where createddate >: TodayDate  '  ;   

Integer AccountCount = Database.CountQuery(Query);     

 

System.debug(' AccountCount ==> ' + AccountCount  );

All Answers

chinnuchinnu

hi ..

 

whats your exact requirement ?

 

thanks

chinnu

rohitsfdcrohitsfdc

hi,

try this

string query=[select count() from Account where createddate>:Date.Today()].format();

 

Sarv333Sarv333

I think you are trying to do like this.

 

Date TodayDate =  Date.Today();   

String query= 'select count() from Account where createddate >: TodayDate  '  ;   

Integer AccountCount = Database.CountQuery(Query);     

 

System.debug(' AccountCount ==> ' + AccountCount  );

This was selected as the best answer
r1985r1985

Thanks a lot:smileytongue: