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
Timmy AhluwaliaTimmy Ahluwalia 

Time Convert

I am building component where i am displaying the events of the particular date which users enter the lightning search component.
I am unable to display all the events seems like some time conversion problem.
I have tried to convert the date to GMT and then using the date to quiry the events but still i am missing the events and also the all day events.
Pleae advice.
Would you please post the code you have so far?
Timmy AhluwaliaTimmy Ahluwalia
This is the Apex what i am working with
    public static string dailyevents(string sDate,  string eDate){
       Date nsdate = Date.valueOf(sDate); system.debug(sDate);
       Date nedate = Date.valueOf(eDate);  system.debug(eDate);
        Time  SGmt = Time.newInstance(0,0 ,0 ,0 );
        Time  EGmt = Time.newInstance(23,59 ,0 ,0 );
        DateTime comS = DateTime.newinstance(nsdate, SGmt); system.debug('comS' + comS);
       DateTime comE = DateTime.newinstance(nedate, EGmt);   system.debug('comE' + comE);
        DateTime Alldaydate = DateTime.newInstance(1845, 01, 01, 00, 00, 00);
        id myId = userinfo.getuserId();
        Id standardId = schema.SObjectType.Contact.getRecordTypeInfosByDeveloperName().get('Standard_Contact').getRecordTypeId();
        list<Event> evt= new list<Event>() ;
        if(sDate != null & eDate !=null){
        //commented the line as giving messagewhile creating the package line 19    
            evt = [select id, StartDateTime,Description, EndDateTime,ActivityDate,ActivityDateTime,DurationInMinutes,  subject, CreatedDate, Who.Name, WhoId,IsAllDayEvent, Location
                             from event  where ownerid = :myId AND StartDateTime >= :comS  AND  EndDateTime <= :comE order by ActivityDate ASC,IsAllDayEvent ASC,ActivityDateTime ASC ];