Closed aalfiann closed 5 years ago
Try to append date instead of Number
...
builder.between('date_created', new Date(1561935478), new Date(1562108278));
Still not working.
the result response is not found or []
Yes because:
console.log(new Date(1561935478));
console.log(new Date(1562108278));
1970-01-19T01:52:15.478Z
1970-01-19T01:55:08.278Z
Finally I found the way..
builder.between('date_created', "2019-07-01 05:57:58", "2019-07-03 05:57:58");
data is found.
So builder.between the valueA or valueB for the date timestamp must be in type of string.
Thank you.
No no. This is not good. Correctly you need add Date
object. This is the best way.
Ok, of course I will use Date object to convert it into string.
Thank you.
You need to convert a String
to Date
object. You can do it like this:
builder.between('date_created', YOUR_DATE_A.parseDate(), YOUR_DATE_B.parseDate());
users.nosql
{"id":"19070212570001dnd1","name":"Aziz","date_created":"2019-07-01 05:57:58.476"}
{"id":"19070212570002dnd0","name":"Tika","date_created":"2019-07-03 05:57:58.476"}
I've tried using YOUR_DATE_A.parseDate() is won't work because my timestamp format is different.
so I need to custom format to make this work like this YOUR_DATE_A = new Date(YOUR_DATE_A).toISOString().replace("T", " ").replace("Z", "");
Is something wrong?
If you have custom date format then write a custom parser for it or prepare date format according to Total.js documentation: YEAR-MONTH-DAY HOUR:MINUTE:SECOND
or DAY.MONTH.YEAR HOUR:MINUTE:SECOND
. Nothing more.
I've read in documentation, the between is builder.between(name, valueA, valueB); which is valueA and valueB is number.
users.nosql
i've tried like this but result is not found
builder.between('date_created', 1561935478, 1562108278);
How to solve this?