You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: content/integrate/redis-data-integration/data-pipelines/transform-examples/formatting-date-and-time-values.md
+67Lines changed: 67 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -120,3 +120,70 @@ SQL Server supports the following date and time data types:
120
120
121
121
122
122
<!-- TODO [ilianiliev-redis]: Test and document the dynamic expressions for the rest of the supported databases - MySQL, PostgresSQL, MongoDB -->
123
+
124
+
125
+
126
+
----
127
+
128
+
## PostgreSQL
129
+
130
+
PostgreSQL supports the following date and time data types:
131
+
132
+
- `date`- represented by Debezium as number of days since epoch (1970-01-01). You can multiply the value by 86400 (the number of seconds in a day) to convert it to seconds since epoch and then use the `STRFTIME` or `DATE` functions to format it.
133
+
```yaml
134
+
transform:
135
+
- uses: add_field
136
+
with:
137
+
fields:
138
+
- field: with_default_date_format
139
+
language: sql
140
+
# Uses the default DATE format
141
+
expression: DATE(event_date * 86400, 'unixepoch')
142
+
```
143
+
144
+
- `time`- the time of microseconds since midnight.
145
+
```yaml
146
+
transform:
147
+
- uses: add_field
148
+
with:
149
+
fields:
150
+
- field: formatted_time
151
+
language: sql
152
+
# Divide by 1000000 to convert microseconds to seconds
- `timestamp`- represented by Debezium as a 64-bit integer representing the microseconds since epoch. You can use the `STRFTIME` function to format it.
168
+
```yaml
169
+
transform:
170
+
- uses: add_field
171
+
with:
172
+
fields:
173
+
- field: formatted_timestamp
174
+
language: sql
175
+
# Divide by 1000000 to convert microseconds to seconds
- `timestamp with time zone`- represented by Debezium as a string representation of the timestamp with time zone information, where the timezone is GMT, e.g. `2025-06-07T10:15:00.000000Z`
180
+
```yaml
181
+
transform:
182
+
- uses: add_field
183
+
with:
184
+
fields:
185
+
- field: formatted_timestamp_with_tz
186
+
language: sql
187
+
# Divide by 1000000 to convert microseconds to seconds
0 commit comments