Hi,
According to this link:
parameters of type datetime should use the method ToOADate() when the intention is to set one parameter with a DateTime value on Dataminer.
During a test, I have set a parameter directly with a DateTime value without calling the method ToOADate() and the results were the same. What's the difference between those two approaches?
The following picture shows the code realized:
The SLProtocol process in DataMiner mainly works with strings and double values.
Setting the value to a DateTime from a QAction works because SLProtocol will try to invoke a conversion to the target type (double/VT_R8) if the source type doesn't match (VT_DATE). This specific conversion only gets applied for sets coming from QActions.
As a general advise, it's probably best to always use .ToOADate() and not rely on any magic conversions.
Checking if .ToOADate() was used for dates is actually part of our quality control on protocols written within SLC.
For clarity and stability it’s an important rule to follow.
Interesting question Mario.
Personally I’m always passing the double value along. “dateTimeObj.ToOADate()”
The fact that it also works passing the full DateTime object along, is probably because the software is capable to cope with that and convert it internally.
It would indeed be good to hear if there are any downsides or what the preferred way would be to offload these DateTime values.