Shape / columns · All operations
Parse a date or time
Parse, format or decompose dates and times; date arithmetic; time zones.
Status
- In arcform
Runs as a SQL step
arcform carries it as a
sql:step today.- Shape of the result
- one row out per row in, with columns added or changed
- Level
- one clause of SQL
The DuckDB step
Parse, truncate and convert zone
CREATE TEMP TABLE result AS
SELECT strptime('03/02/2026 14:30', '%d/%m/%Y %H:%M') AS parsed,
date_trunc('month', DATE '2026-02-10') AS month,
dayname(DATE '2026-02-10') AS weekday,
strftime(timezone('Australia/Sydney', TIMESTAMPTZ '2026-02-10 00:00:00+00'), '%Y-%m-%d %H:%M') AS sydney;
SELECT * FROM result;
SELECT CASE WHEN ((SELECT parsed = TIMESTAMP '2026-02-03 14:30:00' AND month = DATE '2026-02-01' AND weekday = 'Tuesday' AND sydney = '2026-02-10 11:00' FROM result)) THEN 'as expected' ELSE error('a date did not parse, truncate or convert to Sydney time as expected') END AS verdict;- The statement builds its own data.
- It needs nothing installed beyond DuckDB itself.
- The statement checks its own result and raises an error when it is wrong: “a date did not parse, truncate or convert to Sydney time as expected”.
- It passed on DuckDB
v2.0.0 (Cyanoptera) d54cbbe3df.
Variants
- Find the time between two dates
Compute the interval or the count of units between two dates or times.
- Work with durations
Parse, format, decompose and compute on durations and intervals as values of their own.
- Convert to and from epoch numbers
Turn a Unix epoch number into a timestamp, or a timestamp into one.
- Extract a part of a date
Take a component such as the year, month, weekday or hour out of a date or time as its own value.
- Format a date as text
Write a date, time or timestamp out as text by a format pattern.
- Shift a date by an interval
Add or subtract an amount of time to a date, time or timestamp.
- Convert between time zones
Attach, change or convert the time zone of a timestamp.
- Round a date down to a unit
Truncate or bucket a date or time to the start of a unit or a fixed interval.
Test a time of day
Test whether the time of day of a value lies between two bounds.
Build a date from its parts
Make a date, time or timestamp from numbers such as year, month and day, or replace one part of it.
Convert between date and time types
Move date and time values between a tool's date types, such as legacy and current types.
Set a display format
Change how date and time values are shown without changing the stored values.
Date and time function libraries
A tool's whole set of date and time functions, covering parsing, formatting, parts and arithmetic together.
Get the current date and time
Return the date or timestamp at which the run happens.
Parse text into a date or time
Turn text into a date, time or timestamp, by a format pattern or by inference.
What other tools call it
Meridian's classification; an independent blind rating agreed on 86.2% of 312 rows (exact class, version 2).
Alteryx Designer (1)
DateTimeread 2026-09-27Convert date-time data between string formats and the native date-time type
Apache DataFusion (1)
Time and Date Functionsread 2026-09-2724 functions, 5 of them aliases: date_trunc, date_part, date_bin, to_timestamp, now, …
Apache NiFi (1)
Date Manipulationread 2026-09-2711 functions: format, formatInstant, toDate, toInstant, toMicros, …
Apache SeaTunnel (1)
Time and Date Functionsread 2026-09-2724 functions: CURRENT_DATE, CURRENT_TIME, CURRENT_TIMESTAMP / NOW, DATEADD / TIMESTAMPADD, DATEDIFF, …
AWS Glue (3)
Format timestampread 2026-09-27Convert a timestamp column to a formatted string
MonthNameread 2026-09-27Add a column with the month name taken from a date string
To timestampread 2026-09-27Convert a column to timestamp type
Azure Data Factory (2)
Date and time functionsread 2026-09-2734 functions: add, addDays, addMonths, between, currentDate, …
Date functionsread 2026-09-2720 functions: addDays, addHours, addMinutes, addSeconds, addToTime, …
dbt-utils (1)
Date and time functionsread 2026-09-275 macros: date, dateadd, datediff, date_trunc, last_day
DuckDB (7)
Date Format Functions (family)read 2026-09-27The functions documented on the Date Format Functions page
Date Functions (family)read 2026-09-27The functions documented on the Date Functions page
Date Part Functions (family)read 2026-09-27The functions documented on the Date Part Functions page
Interval Functions (family)read 2026-09-27The functions documented on the Interval Functions page
Time Functions (family)read 2026-09-27The functions documented on the Time Functions page
Timestamp Functions (family)read 2026-09-27The functions documented on the Timestamp Functions page
Timestamp with Time Zone Functions (family)read 2026-09-27The functions documented on the Timestamp with Time Zone Functions page
Duckle (10)
Current Timestampread 2026-09-25add the run time as a column
Date Addread 2026-09-25add an interval to a date
Date Diffread 2026-09-25difference between two dates
Epoch Convertread 2026-09-25convert between timestamp and Unix epoch seconds
Extract Partread 2026-09-25extract a date part
Format Dateread 2026-09-25format a date or timestamp as text
Parse Dateread 2026-09-25parse text to a date or timestamp
Time Binread 2026-09-25round timestamps down to fixed-interval buckets
Timezone Convertread 2026-09-25convert a timestamp between time zones with AT TIME ZONE
Truncateread 2026-09-25truncate a timestamp to a unit
EasyMorph (1)
Make date/time columnsread 2026-09-27Derive columns of date and time attributes from a date column
Ibis (49)
BetweenTimeread 2026-09-27Test whether the time of day of a value lies between two bounds
Dateread 2026-09-27Date part of a timestamp
DateAddread 2026-09-27Add an interval to a date
DateDeltaread 2026-09-27Difference between two dates as a whole number of a chosen unit
DateDiffread 2026-09-27Difference between two dates, as an interval
DateFromYMDread 2026-09-27Build a date from year, month and day
DateNowread 2026-09-27Current date
DateSubread 2026-09-27Subtract an interval from a date
DateTruncateread 2026-09-27Truncate a date to a unit such as month or year
DayOfWeekIndexread 2026-09-27Day of the week of a date or timestamp, as a number
DayOfWeekNameread 2026-09-27Day of the week of a date or timestamp, as a name
ExtractDayread 2026-09-27Day of the month of a date or timestamp
ExtractDayOfYearread 2026-09-27Day of the year of a date or timestamp
ExtractEpochSecondsread 2026-09-27Seconds since the UNIX epoch of a date or timestamp
ExtractHourread 2026-09-27Hour of a time or timestamp
ExtractIsoYearread 2026-09-27ISO year of a date or timestamp
ExtractMicrosecondread 2026-09-27Microsecond of a time or timestamp
ExtractMillisecondread 2026-09-27Millisecond of a time or timestamp
ExtractMinuteread 2026-09-27Minute of a time or timestamp
ExtractMonthread 2026-09-27Month of a date or timestamp
ExtractQuarterread 2026-09-27Quarter of a date or timestamp
ExtractSecondread 2026-09-27Second of a time or timestamp
ExtractWeekOfYearread 2026-09-27Week of the year of a date or timestamp
ExtractYearread 2026-09-27Year of a date or timestamp
IntervalAddread 2026-09-27Add two intervals
IntervalFloorDivideread 2026-09-27Divide an interval by a number, rounding down
IntervalFromIntegerread 2026-09-27Build an interval from an integer and a unit
IntervalMultiplyread 2026-09-27Multiply an interval by a number
IntervalSubtractread 2026-09-27Subtract one interval from another
Strftimeread 2026-09-27Format a date, time or timestamp as a string by a format string
StringToDateread 2026-09-27Parse a string into a date by a format string
StringToTimeread 2026-09-27Parse a string into a time by a format string
StringToTimestampread 2026-09-27Parse a string into a timestamp by a format string
Timeread 2026-09-27Time part of a timestamp
TimeAddread 2026-09-27Add an interval to a time
TimeDeltaread 2026-09-27Difference between two times as a whole number of a chosen unit
TimeDiffread 2026-09-27Difference between two times, as an interval
TimeFromHMSread 2026-09-27Build a time from hours, minutes and seconds
TimeSubread 2026-09-27Subtract an interval from a time
TimeTruncateread 2026-09-27Truncate a time to a unit such as hour or minute
TimestampAddread 2026-09-27Add an interval to a timestamp
TimestampBucketread 2026-09-27Floor a timestamp to buckets of a fixed interval, with an optional offset
TimestampDeltaread 2026-09-27Difference between two timestamps as a whole number of a chosen unit
TimestampDiffread 2026-09-27Difference between two timestamps, as an interval
TimestampFromUNIXread 2026-09-27Build a timestamp from a UNIX epoch number in a given unit
TimestampFromYMDHMSread 2026-09-27Build a timestamp from year, month, day, hour, minute and second
TimestampNowread 2026-09-27Current timestamp
TimestampSubread 2026-09-27Subtract an interval from a timestamp
TimestampTruncateread 2026-09-27Truncate a timestamp to a unit such as day or hour
KNIME Analytics Platform (20)
Date Modifierread 2026-09-27Append, change or remove the date part of date&time columns
Date Rounderread 2026-09-27Round dates to a granularity such as start of month, quarter or year
Date Shifterread 2026-09-27Shift dates by a duration or a number of granularity units
Date&Time Differenceread 2026-09-27Compute the difference between two date&time values
Date&Time Format Managerread 2026-09-27Attach a display format to date&time columns without changing the stored values
Date&Time Part Extractorread 2026-09-27Extract fields such as year, month, day or hour from date&time columns
Date&Time to Stringread 2026-09-27Format date&time columns as strings
Date&Time to legacy Date&Timeread 2026-09-27Convert current date&time columns to the legacy date&time type
Duration (Time-based) to Numberread 2026-09-27Convert a time-based duration to a number of hours, minutes, seconds or smaller units
Duration Format Managerread 2026-09-27Attach a display format to duration columns without changing the stored values
Duration Part Extractorread 2026-09-27Extract fields such as hours or minutes from duration columns
Duration to Stringread 2026-09-27Format duration columns as strings
Legacy Date&Time to Date&Timeread 2026-09-27Convert legacy date&time columns to the current date&time types
String to Date&Timeread 2026-09-27Parse date and time strings into date&time columns
String to Durationread 2026-09-27Parse strings into duration columns
Time Modifierread 2026-09-27Append, change or remove the time part of date&time columns
Time Rounderread 2026-09-27Round times to a chosen granularity
Time Shifterread 2026-09-27Shift times by a duration or a number of granularity units
Time Zone Modifierread 2026-09-27Add, change, shift or remove the time zone of date&time columns
UNIX Timestamp to Date&Timeread 2026-09-27Convert integer epoch timestamps into date&time columns
OpenRefine (1)
Date functionsread 2026-09-276 functions: now, toDate, diff, inc, datePart
Polars (6)
Expr.dt (group)read 2026-09-2747 expressions: year, truncate, offset_by, convert_time_zone, strftime and others; decompose, shift and format dates
Expr.str: parse dates and times (group)read 2026-09-274 expressions: strptime, to_date, to_datetime, to_time; parse strings into temporal values by a format
Functions: temporal constructors (group)read 2026-09-274 functions: date, datetime, duration, time; build temporal values from their components
SQL functions: Temporal (group)read 2026-09-273 functions: DATE_PART, EXTRACT, STRFTIME; SQL temporal functions
business_day_countread 2026-09-27Count the business days between a start and an end date, end excluded
from_epochread 2026-09-27Turn a Unix epoch number into a date or datetime
Power Query M (5)
Date functionsread 2026-09-2758 functions: Date.FromText, Date.AddMonths, Date.StartOfWeek, Date.IsInPreviousNDays, Date.WeekOfYear
DateTime functionsread 2026-09-2726 functions: DateTime.FromText, DateTime.LocalNow, DateTime.Date, DateTime.AddZone, DateTime.IsInNextNHours
DateTimeZone functionsread 2026-09-2716 functions: DateTimeZone.SwitchZone, DateTimeZone.ToUtc, DateTimeZone.ToLocal, DateTimeZone.RemoveZone, DateTimeZone.UtcNow
Duration functionsread 2026-09-2713 functions: Duration.From, Duration.FromText, Duration.Days, Duration.TotalHours, Duration.ToText
Time functionsread 2026-09-2710 functions: Time.From, Time.FromText, Time.Hour, Time.StartOfHour, Time.ToText
RapidMiner Studio (5)
Adjust Dateread 2026-09-27Shift dates by adding or subtracting an amount of time
Date to Nominalread 2026-09-27Format a date column as nominal text using a date format pattern
Date to Numericalread 2026-09-27Convert a date column to a number: epoch offset or an extracted component such as month
Nominal to Dateread 2026-09-27Parse text values into date, time or date-time using a format pattern
Numerical to Dateread 2026-09-27Convert milliseconds since epoch into date-time values
Tableau Prep (3)
Convert Datesread 2026-09-27Convert a date field to its year, quarter, month, week, day, weekday name or month name
Custom Fiscal Yearread 2026-09-27Convert dates using a fiscal year that starts in a chosen month
Date functions (group)read 2026-09-2712 functions: DATEADD, DATEDIFF, DATEPARSE, DATETRUNC, NOW; offset, difference, parse, truncate, parts
Trifacta (2)
Date Functions (group)read 2026-09-2740 functions: DATEDIF, DATEFORMAT, PARSEDATE, NETWORKDAYS, CONVERTTOUTC; build, parse, format, decompose and offset dates
Date formatread 2026-09-27Change the display format of Datetime columns
VisiData (2)
type-customdateread 2026-09-23Set type of current column to date parsed with a given strptime format
type-customdate-selectedread 2026-09-23Set type of selected source columns to date parsed with a given format
Background
In DuckDB, strftime and strptime convert between DATE or TIMESTAMP values and strings, often needed when parsing CSV files or moving data between programs.[1] In DuckDB, strptime converts a string to a timestamp by a format string, so strptime('02/03/1992', '%d/%m/%Y') gives 1992-03-02 00:00:00.[1]
When to use it
DuckDB's strptime throws an error when a string does not match its format, while try_strptime returns NULL instead.[1] Parse with the erroring form while you are still learning a column's formats, and switch to the NULL-returning form only once you count the NULLs it leaves behind. (Meridian's view) DuckDB's strptime also accepts a list of format strings and applies them in turn until one succeeds.[2] Settle whether a column is written day first or month first before parsing it, rather than handing both patterns to one list of formats. (Meridian's view) In DuckDB, the two-digit year specifier %y turns 00 to 68 into 2000 to 2068, and 69 to 99 into 1969 to 1999.[1]
ISO 8601, an international standard maintained by the International Organization for Standardization (ISO) and first published in 1988, provides an unambiguous way of representing dates, especially to avoid misinterpreting numeric dates transferred between countries with different conventions.[3] ISO 8601 orders date and time values from the largest unit to the smallest, so their lexicographical order matches chronological order, except for negative years or time offsets.[3] In DuckDB, a DATE literal must be written in the ISO 8601 format YYYY-MM-DD.[4] Write dates for other programs in ISO 8601's year-month-day order. (Meridian's view)
In DuckDB, a TIMESTAMP is more commonly used for local observations of time recorded in an unspecified time zone, and turning such values into unambiguous instants is a common data cleaning problem.[5] Find out which zone a column's clock times were recorded in before comparing them with times from another source. (Meridian's view)
The method
DuckDB's read_csv function and COPY statement accept a DATEFORMAT and a TIMESTAMPFORMAT, so dates can be parsed by a pattern as a file is read.[1] DuckDB counts dates in the Gregorian calendar only, following the SQL standard's lead, even for years before that calendar was in use.[4] DuckDB also accepts the strings infinity and -infinity as dates later and earlier than all others, and epoch as shorthand for 1970-01-01.[4]
In DuckDB, both TIMESTAMP and TIMESTAMP WITH TIME ZONE store a 64-bit integer count of non-leap microseconds since the Unix epoch, 1970-01-01 00:00:00+00.[5] In DuckDB, TIMESTAMP arithmetic, binning and formatting follow the plain rules of Coordinated Universal Time (UTC) without offsets, while TIMESTAMP WITH TIME ZONE does them in a configured time zone, which defaults to the system time zone.[5]
Sources
- [1]Date Format Functions – DuckDBdocumentation
- [2]Timestamp Functions – DuckDBdocumentation
- [3]ISO 8601 - Wikipediasecondary source
- [4]Date Types – DuckDBdocumentation
- [5]Timestamp Types – DuckDBdocumentation
Types it works with
FineType's registry gives 69 types a format string.
Used in
7 Protocols use this operation:
- Epoch AI Notable AI Models dataset, step
models - GLEIF — Legal Entity Identifiers, step
load - EDGAR ↔ GLEIF — Company-to-LEI Crosswalk, step
package - Movies (vega-datasets) dataset, step
load - Online Retail II dataset, steps
retail_lines,retail_orders - NYC Yellow Taxi Trips dataset, step
trips - USGS Earthquakes 2025 dataset, steps
raw_earthquakes,earthquakes