ToDateTime / String Layer
Convert string values to datetime with timezone support. Similar to Python's datetime.strptime() with pytz or Rust's chrono::DateTime::parse_from_str(). Creates a datetime column with configurable precision and timezone handling.
Example conversions:
Input String | Format Pattern | Result |
---|---|---|
2024-01-31 15:30:45 | %Y-%m-%d %H:%M:%S | 2024-01-31 15:30:45 |
31/01/2024 03:30 PM | %d/%m/%Y %I:%M %p | 2024-01-31 15:30:00 |
2024-01-31T15:30:45Z | %Y-%m-%dT%H:%M:%SZ | 2024-01-31 15:30:45 UTC |
2024-01-31T15:30:45.123Z | %Y-%m-%dT%H:%M:%S.%fZ | 2024-01-31 15:30:45.123 UTC |
Jan 31, 2024 at 3:30PM EST | %b %d, %Y at %I:%M%p %Z | 2024-01-31 15:30:00 -0500 |
20240131153045 | %Y%m%d%H%M%S | 2024-01-31 15:30:45 |
1706713845 | %s | 2024-01-31 15:30:45 UTC |
Common applications:
- Standardizing date formats from diverse data sources
- Parsing log file timestamps (web server, application, database logs)
- Converting historical records for time series analysis
- Processing financial transaction timestamps across timezones
- Normalizing IoT device readings from different regions
- Preparing event data for temporal analysis
- Harmonizing dates from international data sources
- Working with API responses from different platforms
Format specifiers compatible with Rust's chrono library:
Date specifiers:
%Y
- Full year (2024)%y
- Year, last two digits (24)%C
- Century (20)%m
- Month, zero-padded (01-12)%b
or%h
- Abbreviated month name (Jan)%B
- Full month name (January)%d
- Day of month, zero-padded (01-31)%e
- Day of month, space-padded ( 1-31)%j
- Day of year, zero-padded (001-366)%a
- Abbreviated weekday name (Mon)%A
- Full weekday name (Monday)%w
- Weekday, 0-based from Sunday (0-6)%u
- Weekday, 1-based from Monday (1-7)
Time specifiers:
%H
- Hour (00-23), zero-padded%k
- Hour (0-23), space-padded%I
- Hour in 12-hour clock (01-12), zero-padded%l
- Hour in 12-hour clock (1-12), space-padded%p
- AM/PM (uppercase)%P
- am/pm (lowercase)%M
- Minute (00-59), zero-padded%S
- Second (00-60), zero-padded (60 for leap seconds)%f
- Nanoseconds (9 digits)%.f
- Decimal fraction of a second with leading dot%.3f
- Milliseconds with decimal point (3 digits)%.6f
- Microseconds with decimal point (6 digits)%.9f
- Nanoseconds with decimal point (9 digits)
Timezone specifiers:
%z
- Timezone offset in form +HHMM or -HHMM%:z
- Timezone offset in form +HH:MM or -HH:MM%Z
- Timezone name or abbreviationZ
- The literal 'Z' character for UTC (zero offset) in ISO 8601 format
Combined format shortcuts:
%F
- ISO 8601 date (equivalent to %Y-%m-%d)%D
- US date (equivalent to %m/%d/%y)%T
- ISO 8601 time (equivalent to %H:%M:%S)%R
- 24-hour clock time (equivalent to %H:%M)%c
- Locale's date and time representation%+
- ISO 8601 / RFC 3339 date & time format
Most common real-world formats directly supported by chrono:
- ISO 8601 with Z:
%Y-%m-%dT%H:%M:%S.%fZ
(2024-01-31T15:30:45.123Z) - ISO 8601 with offset:
%Y-%m-%dT%H:%M:%S%z
(2024-01-31T15:30:45+0000) - RFC 2822:
%a, %d %b %Y %H:%M:%S %z
(Wed, 31 Jan 2024 15:30:45 +0000) - RFC 3339:
%Y-%m-%dT%H:%M:%S%.f%:z
(2024-01-31T15:30:45.123+00:00) - Unix timestamp:
%s
(1706713845) - US format:
%m/%d/%Y %I:%M:%S %p
(01/31/2024 03:30:45 PM) - UK format:
%d/%m/%Y %H:%M:%S
(31/01/2024 15:30:45) - European format:
%d.%m.%Y %H:%M:%S
(31.01.2024 15:30:45) - Database:
%Y-%m-%d %H:%M:%S%.f
(2024-01-31 15:30:45.123) - Apache log:
[%d/%b/%Y:%H:%M:%S %z]
([31/Jan/2024:15:30:45 +0000]) - JavaScript:
%a %b %d %Y %H:%M:%S %Z
(Wed Jan 31 2024 15:30:45 GMT) - Compact date-only:
%Y%m%d
(20240131) - Month-year:
%b %Y
or%m/%Y
(Jan 2024 or 01/2024)
Note: When timezone information is missing from input strings, the specified TimeZone
parameter is applied. If both are missing, the system's local timezone is used as the default. Some specialized formats like Unix millisecond timestamps, Excel dates, or regional calendar systems may require preprocessing before conversion.
Select
columnThe string column containing datetime text. Values not matching the format will become null
.
Format
stringDatetime format pattern using strftime syntax compatible with Rust's chrono library.
Common standard formats:
%Y-%m-%d %H:%M:%S
- ISO date and time (2024-01-31 15:30:45)%Y-%m-%dT%H:%M:%SZ
- ISO 8601 with UTC 'Z' indicator (2024-01-31T15:30:45Z)%Y-%m-%dT%H:%M:%S.%fZ
- ISO 8601 with milliseconds and UTC (2024-01-31T15:30:45.123Z)%Y-%m-%dT%H:%M:%S%z
- ISO 8601 with numeric timezone (2024-01-31T15:30:45+0000)%+
- RFC 3339 (2024-01-31T15:30:45.000+00:00)%a, %d %b %Y %H:%M:%S %z
- RFC 2822 (Wed, 31 Jan 2024 15:30:45 +0000)%a %b %d %Y %H:%M:%S %Z
- JavaScript Date.toString() (Wed Jan 31 2024 15:30:45 GMT)
Regional formats:
%m/%d/%Y %I:%M:%S %p
- US format with AM/PM (01/31/2024 03:30:45 PM)%d/%m/%Y %H:%M:%S
- UK/European format (31/01/2024 15:30:45)%d.%m.%Y %H:%M:%S
- Continental European format (31.01.2024 15:30:45)
Database and log formats:
%Y-%m-%d %H:%M:%S%.f
- SQL database timestamp (2024-01-31 15:30:45.123)[%d/%b/%Y:%H:%M:%S %z]
- Apache/NGINX access logs ([31/Jan/2024:15:30:45 +0000])
Timestamp formats:
%s
- Unix timestamp in seconds (1706713845)
Partial date formats:
%Y%m%d
- Compact date-only (20240131)%b %Y
- Month-year (Jan 2024)%m/%Y
- Numeric month-year (01/2024)
If not provided, the system attempts to infer the format from data patterns.
TimeUnit
enumTime precision for the datetime values. Affects storage and computation granularity.
Automatically determine precision based on input format (recommended for most cases)
Nanosecond precision (10^-9 seconds). For high-frequency data or precise timestamps
Microsecond precision (10^-6 seconds). For detailed system timestamps
Millisecond precision (10^-3 seconds). Common for web and database timestamps
TimeZone
stringTarget timezone name (e.g., UTC, America/New_York, Europe/London). Use standard IANA timezone names. Empty means keep original timezone or use local if none specified.
Exact
boolControls format matching behavior:
true
: String must exactly match format (2024-01-31 15:30:00)false
: Format can match within text (Time: 2024-01-31 15:30:00 GMT)
AsColumn
nameName for the new column. If not provided, the system generates a unique name. If AsColumn
matches an existing column, the existing column is replaced. The name should follow valid column naming conventions.