duckdb-rs
duckdb-rs copied to clipboard
Failed to parse format specifier %u: Unrecognized format for strftime/strptime: %u
According to https://duckdb.org/docs/sql/functions/dateformat#format-specifiers
| Specifier | Description | Example |
|---|---|---|
| … | … | … |
| %u | ISO 8601 weekday as a decimal number where 1 is Monday. | 1, 2, …, 7 |
| … | … | … |
| %w | Weekday as a decimal number. | 0, 1, …, 6 |
| … | … | … |
But I try to do the following in my code:
let query =
r"select
make_timestamptz(id * 1000000) as ts,
strftime(ts, '%H:%M') as s_hm,
strftime(ts, '%z') as s_z,
strftime(ts, '%u') as s_wd,
id,
v0,
c0
from points
where s_hm = '12:00' and s_wd = '7'
order by id desc
limit 144";
let mut stmt = db_conn.prepare(&query)?;
let points_iter = stmt.query_map([], |row| {
Ok(PointRowSelectSubsetExtraPlus {
hm: row.get(1)?,
z: row.get(2)?,
wd: row.get(3)?,
id: row.get(4)?,
v0: row.get(5)?,
c0: row.get(6)?,
})
})?;
And I get this error message:
Error: Invalid Input Error: Failed to parse format specifier %u: Unrecognized format for strftime/strptime: %u
Caused by:
Error code 1: Unknown error code
Whereas using %w works. But I would like to use %u.
Platform is macOS