# Timestamp Shift (TimestampShiftGenerator)

The [Timestamp Shift](/app/generation/generators/generator-reference/timestamp-shift-generator.md) generator shifts timestamps by a random amount of a specific unit of time within a set range.

If the generator cannot process the value, then it uses the fallback generator provided in `fallbacklinks`. The available options for the fallback `generatorId` are:

* `NoFallbackGenerator` - Return an error. This is the default fallback option.
* `PassthroughGenerator`
* `ConstantGenerator`
* `NullGenerator`

## Link object structure <a href="#generator-api-timestamp-shift-link-object" id="generator-api-timestamp-shift-link-object"></a>

The Timestamp Shift generator does not support linking. It can be self-consistent or consistent with another column. You cannot configure differential privacy.

The `metadata` object is populated from the [`TimestampShiftMetadata`](https://app.tonic.ai/apidocs/index.html#/models/TimestampShiftMetadata) object, which includes:&#x20;

* For text source columns, the format of the datetime values in the original data.
* For integer source columns (Unix timestamps), the unit to use.
* The part of the timestamp to shift.
* The minimum amount to shift the value by. Use negative numbers to move the value earlier.
* The maximum amount to shift the value by.

```json
{
  "schema": "string",
  "table": "string",
  "column": "string",
  "path": "string",  //JSON fields only
  "dataType": "string",  //MongoDB, Amazon DynamoDB, and JSON fields only
  "metadata": {
    "presetId": "string",
    "generatorId": "TimestampShiftGenerator",
    "dateFormat": "enum",  //For text source fields
    "unixTimestampFormat": "enum",  //For integer source fields
    "datePart": "enum",
    "minShiftValue": numeric,
    "maxShiftValue": numeric,
    "isConsistent": boolean,
    "consistencyColumn": "string",
    "encryptionProcessor": "x-on", //To use configured Structural data encryption
    "customValueProcessor": "string"  //If custom value processor applied
  }
}
```

## Example replacement <a href="#generator-api-timestamp-shift-replacement" id="generator-api-timestamp-shift-replacement"></a>

The following example replacement for the Timestamp Shift generator updates text timestamps in the format `yyyy-MM-dd`.

The generator shifts the day anywhere from 3 days before the current day to 3 days after the current day.

The generator is consistent with the `order` column.

Values that cannot be processed are passed through.

```json
{
  "name": "user",
  "schema": "public",
  "table": "events",
  "links": [
    {
      "schema": "public",
      "table": "events",
      "column": "start",
      "metadata": {
        "presetId": "TimestampShiftGenerator",
        "generatorId": "TimestampShiftGenerator",
        "dateFormat": "yyyy-MM-dd",
        "datePart": "Day",
        "minShiftValue": -3,
        "maxShiftValue": 3,
        "isConsistent": true,
        "consistencyColumn": "order"
      }
    }
  ],
  "fallbackLinks": [
    {
      "schema": "public",
      "table": "events",
      "column": "start",
      "metadata": {
        "generatorId": "PassthroughGenerator"
      }
    }
  ]
}
```


---

# 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/api/quick-start-guide/tonic-api-generator-assignment/generator-api-reference/generator-api-ref-timestamp-shift.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.
