The SetScanDate script populates the ScanDate index field with the incorrect time


Version: R70.6

Article ID: PC000042

The SetScanDate script populates the ScanDate index field with the incorrect timemain image

Description

When using the SetScanDate custom code script, the date is correct but the time is several hours off. This is due to the fact that the document creation time is stored using Coordinated Universal Time (UTC), which is the same as Greenwich Mean Time (GMT).

Summary

The SetScanDate custom code script uses the batch API function call TryGetDocumentCreatedDateTime which retrieves the creation date and time using the UTC time zone. However, users may want the current time displayed on their computer to be used to populate the ScanDate index field. This requires a simple change to the custom code script.

Follow these steps to modify the SetScanDate custom code script:

  1. If you want to modify this script for just one job, open up Job Properties for that job and open up the Script Editor for where ever you imported the SetScanDate script.
  2. Go to line 48 and replace: if (!this.Batch.TrySetIndexValue(id, “Scan”Date”, documentCreatedDate, true, out error))

with:if (!this.Batch.TrySetIndexValue(id, “Scan”Date”, documentCreatedDate.ToLocalTime(), true, out error))

The script will now convert the document created time from UTC to your automation server's local time zone.

Note: By design, Capture utilizes UTC time to ensure all timestamps are normalized. When using Capture in a distributed scanning environment that could span multiple time zones, using the above code change to localize the timestamps could become confusing to users.