String to date conversion

Is there an easy way to convert a string like “11/15/03 0:00” to a date?

There is a way but I’m not sure I’d describe it as easy, It’s not hard either. I’d probably describe it as tedious. You’d have to use a combination. Of substr(), concat(), and strdt() functions. I’d give you an example but I’m on my phone right now. It’s been on my list to do to write a function that allows you to do that similarly to Java’s SimpleDateFormat or DateTimeFormatter. Let me know if that’s something you would find useful.

I found your exact same question on Stackoverflow for an example https://stackoverflow.com/questions/11135233/sparql-date-conversion

A function as easy to use as those in the lubridate package in R would be very useful.
thanks
phil

I’ll take a look. One comment on the SO answer. No doubt Steve knows way more about this stuff than I do but I don’t quite agree with the suggestion, “I think the answer is that you can, but probably don’t want to!“. I get where he’s coming from but it’s not like triples are free and duplicated data isn’t automatically consistent when it’s updated. You might be able to get the consistency with a rule but again they’re not free either.

Phil,
That’s why I do as much data manipulation as possible in R, either before I upload into Stardog , or processing the query result since R is my usual consumer as well. Of course that luxury is not always available, depending on the situation.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.