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
afindieafindie 

Convert String to UTC for apex query

Hi.

 

I need to pass a string into apex as " 7/23/2010" and convert this into utc format.

So I can use this UTC and query against my data.

 

However, I can't find anything that convert a string into the UTC format.

 

thanks in advance.

 

andy.

forecast_is_cloudyforecast_is_cloudy

If, as you said, you just want to use the date value in a SOQL query, couldn't you simply do this:

 

 

Date d = Date.parse('7/23/2010');
My_Custom_Obj__c a = [select id from My_Custom_Obj__c where my_date_field__c = :d];