How to add plus 1 day to a timestamp in Cassandra SQL?
Yes, you can specify a time component along with the date arithmetic. In this case, changing 1
to 1d
(one day) solves this:
> SELECT studentid,course_date + 1d as nextday FROM students WHERE studentid=1;
studentid | nextday
-----------+---------------------------------
1 | 2022-01-04 06:00:00.000000+0000
(1 rows)
For more information, I recently wrote a blog post on the use of Arithmetic Operators in Apache Cassandra 4.0 as well as a short video on this topic! Below is a more comprehensive list of the valid time duration codes: