In RethinkDB, you need to save a document that contains several fields with dates. On these dates you will need to search for documents in RethinkDB. The problem is how to save the date in the rubbish.

I get the time values ​​like this:

public class Time { public static String now() { return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(Calendar.getInstance().getTime()); } public static long timestampNow() { return Calendar.getInstance().getTime().getTime(); } public static long timestamp(String datetime) { try { SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss"); Date parsedDate = dateFormat.parse(datetime); return parsedDate.getTime(); } catch(Exception e) { return 0; } } } 

I save documents in the database as follows:

 @Test public void insert() { r.db("test").table("test").insert( r.hashMap() .with("key", "value") .with("objectUID", 1234) .with("time", r.epochTime(Time.timestampNow()).toIso8601()) ).run(conn); } 

At the same time I get the error ReqlQueryLogicError: Error in time logic: Year is out of valid range: 1400..10000. . If you save the date as r.iso8601("2013-08-09T18:53:15.012-07:00").toIso8601().run(conn); , I get an error with the message that the time zone is not specified. But the time zone is missing in the dates of the documents that come to me.

How to save the date in RethinkDB?

    0