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
Arun_PaliArun_Pali 

Filtering using ActivityDateTime

Hello there,
I am trying to write an SOQL to filter events whose activity datetime is greater than the current date time. I am unable to get the current datetime format to yyyy-mm-dd Taa:bb:cc:Z format using Apex API. Any idea how can I convert current datetime format to yyyy-mm-dd Taa:bb:cc:Z using Apex API. Your help would be greatly appreciated.


Thanks.
SuperfellSuperfell
Just create a dateTime object and bind to that, rather than trying to format it yourself, something like

datetime n = dateTime.now();
List e = [select id, subject from event where activityDateTime > :n];
Arun_PaliArun_Pali
hah ! I missed this .. Thanks a lot Simon !!