+ Start a Discussion
Linda 98Linda 98 

Set reminder time


I am creating a task and reminder using workflow when certain conditions satisfy.
It creates a task with reminder as default(8 AM)
but i want to set it something similar to custom datetime field on task.For example, if my custom field value is set to 3/15/2014   5:40PM then i want reminder time to set to 6 PM .
I am writing a trigger to achieve this but not sure of time rounding to nearest time.please help.
Eli Flores, SFDC DevEli Flores, SFDC Dev
assuming you are quantizing on the hours, something like this should work

datetime dt = DateTime.now();

dt = dt.addHours(1).addMinutes(-dt.minute());