Date Truncation
Truncates a date value or a timestamp to a specific part.
For a date or a timestamp, you can truncate to the year, month, or day.
For a timestamp, you can also truncate to the hour, minute, or second.
Characteristics
Consistency | No, cannot be made consistent. |
Linking | No, cannot be linked. |
Differential privacy | No |
Data-free | No |
Allowed for primary keys | No |
Allowed for unique columns | No |
Uses format-preserving encryption (FPE) | No |
Privacy ranking | 5 |
Generator ID (for the API) |
How to configure
To configure the generator:
From the dropdown list, select the part of the date or timestamp to truncate to. For both date and timestamp values, you can truncate to the year, month, or day. When you select one of these options, the time portion of a timestamp is set to 00:00:00. For the date, the values below the selected truncation value are set to 01. For example, when you truncate to month, the day value is set to 01, and the timestamp is set to 00:00:00. For a timestamp value, you also can truncate to the hour, minute, or second. The date values remain the same as the original data. The time values below the selected truncation value are set to 00. For example, when you truncate to minute, the seconds value is set to 00.
Toggle the Birth Date option. When you enable Birth Date, the generator shifts dates that are more than 90 years before the generation date to the date exactly 90 years before the generation date. For example, a generation occurs on January 1, 2023. Any date that occurs before January 1, 1933 is changed to January 1, 1933.
This is mostly intended for birthdate values, to group birthdates for everyone who is older than 89 into a single year. This is used to comply with HIPAA Safe Harbor.
If Structural data encryption is enabled, then to use it for this column, toggle Use data encryption process to the on position.
Truncation examples
Here are examples of date and time values and how the selected truncation affects the output:
Option | Date value | Timestamp value |
---|---|---|
Original value | 2021-12-20 | 2021-12-20 13:42:55 |
Truncate to year | 2021-01-01 | 2021-01-01 00:00:00 |
Truncate to month | 2021-12-01 | 2021-12-01 00:00:00 |
Truncate to day | 2021-12-20 | 2021-12-20 00:00:00 |
Truncate to hour | Not applicable | 2021-12-20 13:00:00 |
Truncate to minute | Not applicable | 2021-12-20 13:42:00 |
Truncate to second | Not applicable | 2021-12-20 13:42:55 |
Last updated