You need to sign in to do that
Don't have an account?

Time Convert
Hi,
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.
Thanks.
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.
Thanks.
@AuraEnabled
public static string dailyevents(string sDate, string eDate){
Date nsdate = Date.valueOf(sDate); system.debug(sDate);
Date nedate = Date.valueOf(eDate); system.debug(eDate);
system.debug(sDate);
system.debug(eDate);
system.debug(nsdate);
system.debug(neDate);
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 ];
}