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
GraceWGraceW 

Query event during a time period

Hi,
        What do I need to modify in order to get the following code to run?  Especially for the conversion between Java Date and SF DateTime. Thanks!

  QueryResult getEvents(Date beginDate, Date endDate, String ownerID, SoapBindingStub binding )throws RemoteException{
        String queryStr="select * from Event where OwerId = '" + ownerID + "' and ActivityDateTime > "
                        +  beginDate + " and ActivityDateTime < " + endDate;
        QueryResult qr = null;
        try{
            qr = binding.query(queryStr);
            return qr;
         }catch(Exception e){
             System.out.println(e.toString());
             return null;
         }
    
    }
SuperfellSuperfell
You can't do select *, you have to list out the fields explicitly.
The dateTimes need to be in ISO8601 format (e.g. 2006-12-22T13:00:00Z)
GraceWGraceW
Really appreciate your prompt help!