+ 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