Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

datetime to date

Hello,

I'm trying to group my datetimes to 1 record for each day.

I found someting with timestamp and date(datetime, 'YYYY-MM-DD') but it's not working so far.

My query is:

LOAD "vessel_id",

    name as Route,

    datetime as "Date";

SQL SELECT "vessel_id",

    name,

    datetime

FROM route

1 Solution

Accepted Solutions
Anonymous
Not applicable
Author

You need to knock the decimal off your timestamp with the floor() function, something like :

     date(floor(datetime), 'YYYY-MM-DD')

View solution in original post

4 Replies
its_anandrjs

Hi,

Try this expression

LOAD "vessel_id",

    name as Route,

    Date(datetime, 'YYYY-MM-DD') as "Date";

SQL SELECT "vessel_id",

    name,

    datetime

FROM route

Regards

Anand

Anonymous
Not applicable
Author

You need to knock the decimal off your timestamp with the floor() function, something like :

     date(floor(datetime), 'YYYY-MM-DD')

Not applicable
Author

Hello,

Thank you, this is working so far!

Now i want to group the table by the dates + name. When i do group by datetime, name, "vessel_id" it doesn't work.

Not applicable
Author

Works great, even the group by works here. Thank you!