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
Sharath ChandraSharath Chandra 

can any one please let me know what is the error in the SOQL query

Please let me know the error in "SELECT id, name, status_del__c, rate_state2__c, quote_origin__c, createdby.profile.name, lastmodifiedby.profile.name, (CreatedDate - (1/6.0)) quoted_date, lastmodifieddate FROM opportunity " 
Best Answer chosen by Sharath Chandra
Kapil KaushikKapil Kaushik
Hi Sharath,

Your query is invalid becuase we can not do any Artithmetic operations while querying any object.

So the best way is to get the Records as they are returned from the object and then you can use the Date are DateTime class functions to convert them into EST or any other time zone in which you want.

The methods of Date and DateTime class are quite handy and give accurate results.

Please let us know your any further queries.

Thanks,
Kapil Kaushik

All Answers

NagendraNagendra (Salesforce Developers) 
Hi Sharath,

Could you please elaborate your query in specific to created date, so that it would be easier to understand the query and helps in resolving the problem.

Best Regards,
Nagendra.P
Sharath ChandraSharath Chandra
Hi Nagendra, I want to extract the record createdDate in EST format for which after some browsing I've found that we can subtract CreatedDate with (1/6.0) (as UTC is 4hrs ahead of EST). But I am getting an error when I execute this SOQL query. Really appreciate you help with this.
NagendraNagendra (Salesforce Developers) 
Hi Sharath,

Can you please post the screen shot of the error which you are getting ?

Best Regards,
Nagendra.P
Kapil KaushikKapil Kaushik
Hi Sharath,

Your query is invalid becuase we can not do any Artithmetic operations while querying any object.

So the best way is to get the Records as they are returned from the object and then you can use the Date are DateTime class functions to convert them into EST or any other time zone in which you want.

The methods of Date and DateTime class are quite handy and give accurate results.

Please let us know your any further queries.

Thanks,
Kapil Kaushik
This was selected as the best answer
NagendraNagendra (Salesforce Developers) 
Hi Sharath,

I tried executing your SOQL query in the query editor,i understand that it is not allowing any arithmetic calculations in the while fetching any object details.I agree with Kapil's statement to first fetch the records and then use DateTime functions to convert them into your required time zone. 

Best Regards,
Nagendra.P