Trouble calculating time and days between timeStamps in Workflow
I'm having trouble calculating the time (hours) and days between two dates Windchill provides (created and last modified) on a document. Google searching for Java examples results in tons of ideas but I haven't been able to get any to work. I think my problem is in how the stamps are stored or the format of the stored stamps. The log outputs look good but the math fails.
Here is what I have so far. The math function fails with: error: bad operand types for binary operator '-'.
My Workflow code:
com.ptc.core.lwc.server.PersistableAdapter obj = new com.ptc.core.lwc.server.PersistableAdapter(primaryBusinessObject,null, java.util.Locale.US, new com.ptc.core.meta.common.DisplayOperationIdentifier());
obj.load("thePersistInfo.createStamp", "thePersistInfo.modifyStamp");
Object CreateStamp = obj.get("thePersistInfo.createStamp");
Object ModifiedStamp = obj.get("thePersistInfo.modifyStamp");
System.out.println("Create Stamp: " + CreateStamp);
System.out.println("Modified Stamp: " + ModifiedStamp);
//java.time.LocalDateTime hours = Math.abs((ModifiedStamp - CreateStamp)/(1000*60));
//System.out.println("Hours between: " + hours);
//Outputs to BackgrounMethodServer:
//2023-11-29 16:12:53,387 INFO [WfUserWorkQueue.PoolQueueThread-42] wt.system.out Administrator - Create Stamp: 2023-11-27 23:41:35.0
//2023-11-29 16:12:53,391 INFO [WfUserWorkQueue.PoolQueueThread-42] wt.system.out Administrator - Modified Stamp: 2023-11-29 19:08:43.0
