+ Start a Discussion
RJoshiRJoshi 

Task due Date from buisness hour date

hi

 

I m calculting date with help of buisness hour class and assigning it due date of task . but some data type issue is coming.

My code:

 

DueDate= BusinessHours.addGmt(stdBusinessHours.id,dt , 23 * 60 * 60 * 1000L);
     
     ActivityDueDate = Date.valueof(DueDate);
    

    Task taskIns = new Task (OwnerId = '00570000001R8mS' ,Subject = 'Coordinate Shipment Refill',Priority = 'Normal'  ,  Activity_Type_gne__c = 'Coordinate Shipment Refill' , ActivityDate = ActivityDueDate );                         
    tsk_insert.add(taskIns);

 

Im getting this error Invalid date: java.util.GregorianCalendar .

 

Can anybody tell me correct method to convert datetime field into date.

 

Thanks inadvance

Swati

 

werewolfwerewolf
Try making a new Date object specifying the year, month and day from the Datetime.