-
Why does this code seem to prefer parsing the date/time from a String rather than using the Timestamp__c value, without needing to convert? Seems like this should be re-written to prefer not to convert/parse the date/time from string. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
This is by design, the string-based value is more accurate than the actual |
Beta Was this translation helpful? Give feedback.
This is by design, the string-based value is more accurate than the actual
Timestamp__c
datetime field - I have a comment elsewhere in the codebase that provides a bit more context, but essentially, the issue is that Salesforce does not provide accurate timestamps for platform events within an Apex trigger (see screenshot below), so I use the string version of the timestamp because it will include accurate milliseconds when it's converted back into a datetime value.