# Timestamp Shift Generator

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

For values that the generator cannot process, you can specify a fallback generator to use.

## 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="/pages/RcKnFROcA6kW0PwapX7B"><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. From the **Fallback Generator** dropdown list, select how to handle values that the generator cannot process.\
   \
   By default, this is set to **Fail on error**, meaning that the generation fails when a value cannot be processed.\
   \
   You can instead assign a fallback generator, either:
   1. Passthrough, to pass through the value without changing it.
   2. Constant, to use a replacement value that you provide.
   3. Null, to null out the value.&#x20;
5. Toggle the **Consistency** setting to indicate whether to make the generator consistent.\
   \
   By default, consistency is disabled.
6. 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.
7. If [Structural data encryption](/app/generation/generators-assign-config/generators-data-encryption-config.md) is enabled, then to use it for this column, in the advanced options section, toggle **Use data encryption process** to the on position.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.tonic.ai/app/generation/generators/generator-reference/timestamp-shift-generator.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
