umuthorax
umuthorax

Reputation: 143

EXTRACT for TIMESTAMP types in SQLite3

It seems extract function is not supported by SQLite3 for timestamp types (ref). For example;

select
 extract(year from l_shipdate) as l_year
from
 ...

gives the following error; Error: near "from": syntax error

I wonder whether there is an alternative way to do this in SQLite3 (or through rewriting the SQL query).

Thanks in advance,

Upvotes: 2

Views: 1264

Answers (1)

Pentium10
Pentium10

Reputation: 208042

Try this

select strftime('%Y', l_shipdate) as l_year from...

Upvotes: 6

Related Questions