cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Did you get an answer that solved your problem? Please mark it as an Accepted Solution so others with the same problem can find the answer easily. X

retrieving rows irrespective of time for the date from Datatable TWX 9.1

VaibhavShinde
16-Pearl

retrieving rows irrespective of time for the date from Datatable TWX 9.1

Hi,

I am looking to retrieve data from datatable based on Current date but in Datatable stored format is Date and time.

if given input is Date only without time , i need to fetch matching records for the input date. how we can do it in TWX 9.1.

 

Thanks

2 REPLIES 2

1 day is 24(h)*3600(s)*1000(ms), maybe you can try

 

DateYouSelect < recordTime < DateYouSelect+24(h)*3600(s)*1000(ms)

OR  recordTime/[24(h)*3600(s)*1000(ms)] = Dateyouselect/[24(h)*3600(s)*1000(ms)]

 

making mathmatic calculation to timestamp sometimes work

 

Hello @VaibhavShinde

 

You can use QueryDataTableEntries service of the data table by specifying query parameters, BETWEEN current date of "00:00:00" and "23:59:59:999".

 

Sample Code:

var d = new Date(); //Current Date
var fromdt = new Date(d.getFullYear(), d.getMonth(), d.getDate(), 0, 0, 0);
var todt = new Date(d.getFullYear(), d.getMonth(), d.getDate(), 23, 59, 59, 999);
var myquery =
{
    "filters": {
        "type": "BETWEEN",
        "fieldName": "date",
        "from": Date.parse(fromdt) ,
        "to": Date.parse(todt)
    }
};
// result: INFOTABLE dataShape: ""
var result =  me.QueryDataTableEntries({
    maxItems: 500 /* NUMBER */,
    query: myquery /* QUERY */,
    values: undefined /* INFOTABLE */,
    source: undefined /* STRING */,
    tags: undefined /* TAGS */
});

 

 

Top Tags