# Timestamp Shift Generator

Shifts timestamps by a random amount of a specific unit of time within a set range.

## Supported date-only formats <a href="#timestamp-shift-date-only-formats" id="timestamp-shift-date-only-formats"></a>

For date-only values, the Timestamp Shift Generator supports the following date formats. The example values are all for February 23, 2021.

* `MM/dd/yyyy` - 02/23/2021
* `MM/dd/yy` - 02/23/21
* `MM-dd-yyyy` - 02-23-2021
* `yyyyMMdd` - 20210223
* `yyyy/MM/dd` - 2021/02/23
* `MMddyyyy` - 02232021

## Supported datetime formats

For string columns that contain datetime values, the Timestamp Shift generator supports the following formats. The example values are all for midnight on February 23, 2021:

* `yyyy-MM-dd HH:mm:ss` - 2021-02-23 00:00:00
* `yyyy-MM-ddTHH:mm:ss` - 2021-02-23T00:00:00

## Characteristics <a href="#timestamp-shift-characteristics" id="timestamp-shift-characteristics"></a>

<table data-header-hidden><thead><tr><th valign="top"></th><th valign="top"></th></tr></thead><tbody><tr><td valign="top"><strong>Consistency</strong></td><td valign="top">Yes, can be made self-consistent or consistent with another column.</td></tr><tr><td valign="top"><strong>Linking</strong></td><td valign="top">No, cannot be linked.</td></tr><tr><td valign="top"><strong>Differential privacy</strong></td><td valign="top">No</td></tr><tr><td valign="top"><strong>Data-free</strong></td><td valign="top">No</td></tr><tr><td valign="top"><strong>Allowed for primary keys</strong></td><td valign="top">No</td></tr><tr><td valign="top"><strong>Allowed for unique columns</strong></td><td valign="top">No</td></tr><tr><td valign="top"><strong>Uses format-preserving encryption (FPE)</strong></td><td valign="top">No</td></tr><tr><td valign="top"><strong>Privacy ranking</strong></td><td valign="top"><ul><li>3 if not consistent</li><li>4 if consistent</li></ul></td></tr><tr><td valign="top"><strong>Generator ID (for the API)</strong></td><td valign="top"><a href="../../../api/quick-start-guide/tonic-api-generator-assignment/generator-api-reference/generator-api-ref-timestamp-shift"><code>TimestampShiftGenerator</code></a></td></tr></tbody></table>

## How to configure <a href="#timestamp-shift-configure" id="timestamp-shift-configure"></a>

To configure the generator:

1. From the **Date Part** dropdown list, select the unit of time to use for the minimum and maximum shift.
2. In the **Minimum Shift** field, type the minimum amount the value can be shifted from the original value.\
   \
   Use negative numbers to indicate to shift the date to the past.\
   \
   For example, assume that the date part is Day. `-3` indicates that the day cannot be shifted earlier than 3 days before the original day. `3` indicates that the date cannot be shifted earlier than 3 days after the original day.
3. In the **Maximum Shift** field, type the maximum amount by which the value can be shifted from the original value.\
   \
   For example, assume that the date part is Day. `5` indicates that the date cannot be shifted later than 5 days after the original day.
4. Toggle the **Consistency** setting to indicate whether to make the generator consistent.\
   \
   By default, consistency is disabled.
5. If you enable consistency, then by default the generator is self-consistent.\
   \
   To make the generator consistent with another column, from the **Consistent to** dropdown list, select the column.\
   \
   When a column is consistent with itself, then the same date part value is always shifted by the same amount.<br>

   When a column is consistent with another column, then for the same value in the other column, the date part value is always shifted by the same amount. For example, for the same value of `username`, the `birthdate` column value is always shifted by the same amount.<br>

   If multiple columns that use the Timestamp Shift Generator are consistent with the same other column, then for those columns, the date part value shifts by the same amount. For example, the `startdate` and `enddate` columns are both consistent with the `username` column. Both `startdate` and `enddate` use the Timestamp Shift Generator. For the same value of `username`, both `startdate` and `enddate` are shifted by the same amount.
6. If [Structural data encryption](https://docs.tonic.ai/app/generation/generators-assign-config/generators-data-encryption-config) is enabled, then to use it for this column, in the advanced options section, toggle **Use data encryption process** to the on position.
