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

Task due Date from buisness hour date



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(,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 );                         


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


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


Thanks inadvance



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