shorty
shorty

Reputation: 499

SQLite: Combine Date Column & Time Column

i simply have two fields. dtStartTime and dtStartDate.

I want to do a query now which returns one combined field dtStart using SQLite

I have tried SELECT (dtStartDate+dtStartTime) as dtStart1, from ... but it returns wrong values...

Thank you, shorty

PS: Dates are stored as unixepoch

Upvotes: 2

Views: 3223

Answers (2)

newtover
newtover

Reputation: 32094

SELECT datetime(d, t)
FROM (
  SELECT date('now') as d, time('now') as t) as dt;

Upvotes: 3

zeFrenchy
zeFrenchy

Reputation: 6591

probably:

SELECT DATETIME(DATE(dtStartDate) || ' ' || TIME(dtStartTime)) FROM YourTable;

Upvotes: 0

Related Questions