I have created below code for my use, everything is working fine except the time duration object. How do I substract the End date time with Start Date time to get the job duration?
If you take the data and do it by itself, you get a formatting error. You are trying to pass a datetime object to a string formatter. I’m assuming you want seconds, so try this.
Thanks for pitching in yet again and it worked perfectly. So the result is in seconds right? if it want the result to come in mins then do I use: ([datetime]$.Endtime - [DateTime]$.Starttime).TotalMinutes}}
Also, I noticed that you used @{n=‘Duration’ instead L, could you please explain me the difference between these 2? Thank you so much again.
@Maxwell, yes if you change the .totalseconds to .totalminutes. And apologies for adding confusion, Olaf explained they are the same. I never got in the habit of L so I didn’t even think about it when typing it out. For readability for yourself and others, the full names should be used in scripts. Spacing helps too. Also in this case, you can drop the type accelerator since the value is already of that type.