Why do I lose 4 hours when converting a date to a double and back again in a SharePoint designer workflow? More importantly, what's the proper way to do a date calculation in a workflow? Most importantly, why is SharePoint the worst and no one noticed?
I'm creating a SharePoint 2010 workflow in Designer 2013 (evidently because Satan won). I need to find a date based on a Date Time column called Due Date. I've mutilated my workflow so much trying to figure out what's going on that I'm not sure of the original process. I think I created a Number variable called NewDate from Due Date then calculated Date Column as NewDate minus 1209600 (2 weeks).
If Due Date is the 19th at 12:00:00 am, Date Column comes out as the 4th at 8:00:00 pm, instead of the 5th at 12:00
More interesting is if I cast Due Date to a number and then back to a date, I get the 18th at 8:00:00pm
DueDate as Date - 2015-05-19 12:00:00 AM
DueDate as Date to Double - 3640982400
Due Date as Date to Double to Date - 2015-05-18 8:00:00 PM
As SharePoint is exhausting, I could be missing something simple. Or it's another simple thing Microsoft missed. How are we meant to calculate dates in a workflow?
I could just add 4 hours but I feel like that's the kind of kludge I for some reason refuse to learn is what SharePoint solutions are made of
Add time to Date
Action? And set it likeAdd -14 Days to DueDate (Output to Variable: YourDateVariable)
– Amal Hashim May 12 '15 at 19:51