How to compare string or date type? #719
-
Hello, I have one more question. but, I can't find a way to compare strings, to be exact xsd:dataTime data type. Here's my insert query:
And I tried the query below ( ?dt1 and ?dt2 respectively)
Even if I change the filter to the content below, it will respond to [].(Normal when the filter is removed)
Even if I look up the document, it's hard to find information about the manipulation of the date and string So, I have two questions.
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
Hi @keispace ! Good to see you again. TL;DR: From what i know the Fluree database currently supports date/time predicates, but lacks direct date math functionalities. While there are functions to extract date components, using numerical comparisons for date operations is a bit clunky. The fluree team is looking into plans to improve this aspect in the future right now tho. Could you please delve further into the first question? I couldn't understand it at all 🤔
Resources
|
Beta Was this translation helpful? Give feedback.
Oh i got it now 🙌🏼 💡.
The closest thing right now (as it was said) are the
date fns
(not mentioned on documentation yet).With the
date-fns
you will get a numeric value for eachyear
,month
,day
,hours
,minutes
andseconds
. To then write afilter
for each one specifying that thedate
year
should begreater
thanx
, and/or themonth
should be greater and so on...You can see all the
date-fns
available over here:db/src/fluree/db/query/exec/eval.cljc
Lines 295 to 296 in 3dfce29