I stored date in property in some edges in graph database.
Now I want to get this date that I can compare it with date in javascript function.
This is example of edge structure:
{
"@type": "d",
"@rid": "#24:27592",
"@version": 1,
"@class": "Edge_Bus",
"out": "#22:2643",
"in": "#22:3946",
"busId": 10736921,
"departureTime": "2016-11-08 19:40:00",
"@fieldTypes": "out=x,in=x,trainId=l,departureTime=t"
}
I want to get departureTime
.
I try:
var val = edge.field('departureTime');
and
var val = new Date(edge.field('departureTime'));
I suppose that val
is type of java.util.Date
and when I try to compare it with standard Date in Javascript (var searchDateTime = new Date("2016-11-08 12:00:00");
) I got wrong comparison result.
I was tried:
val > searchDateTime
val.getTime() > searchDateTime.getTime()
I found some answer on https://groups.google.com/forum/#!topic/mozilla.dev.tech.js-engine.rhino/x0fjcn4X9jY
And
Parse org.mozilla.javascript.NativeDate in Java.util.Date
Is this suppouse is ok (because OrientDB has Rhino engine) and is it this right way to get Date from OrientDb in Javascript function? Thank you :)