Question about conversion of datetime to epoch

Hii, I wanted to know if there's a way to convert datetime stored in a node to epoch, without using lambdas because I don't want to compromise on performance. The reason why I'm doing this is to figure out the time difference between two timestamp values in nodes, something like this : - g.V().has("Customer",'customerId', 'abc').out() .has("Attempt", "eventTimestamp", between(datetime(LocalDateTime.parse('2023-03-01T00:00:00').minusDays(15).toString()), datetime(LocalDateTime.parse('2023-03-01T00:00:00').minusDays(1).toString()))) .as('a').values('nodeCreatedAt').in().hasLabel('Device').values('nodeCreatedAt').as('b') .math('a - b').by('nodeCreatedAt')
2 Replies
spmallette
spmallette•2y ago
At this time, Gremlin does not have any builtin functions that can manipulate datetime. It is possible that those sorts of functions along with other common string/list/etc operations will arrive as early as 3.7.0. For now you would have to use lambdas, if your graph supports them, or pull your data back to the client and manipulate the date difference there.
yadav.sunny05
yadav.sunny05•2y ago
Thank you very much, will use lamda only for now Or will probably store in epoch only🤔
Want results from more Discord servers?
Add your server