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
Ravi Dutt SharmaRavi Dutt Sharma 

convertTimeZone() used in SOQL does not take care of daylight saving

The convertTimeZone() does not work properly between 12am to 1pm. It gives the output for the previous day. My user is in (GMT+10:00) Australian Eastern Standard Time (New South Wales) (Australia/Sydney) timezone and when the time in this timezone is between 12am to 1am, the SOQL query gives incorrect results:

SELECT Id FROM Activity__c WHERE DAY_ONLY(convertTimeZone(Activity_Closed_Date_Time__c)) =: Date.today() 
 
Manj_SFDCManj_SFDC
Hey Ravi
you need to consider the timezone, while using the Activity_Closed_Date_Time__c , may be you can do this 
Activity_Closed_Date_Time__c -10/24  where 10 is Timezone and 24 is no of hours/day