jen
10/16/2023, 3:35 PMmessage
records within the past 2 days, by doing a WHERE message.messagedate > 'date_im_comparing_goes_here'
(the formatting for the date is obtained using moment() and format module, like so:
let two_days_ago = format.format({value: moment().subtract(2, 'days').toDate(), type: format.Type.DATE});
which gives me something like ‘14-Oct-2023’ to compare with in my SQL. I’d like to modify this to use a number of hours instead, e.g. the last 8 hours. I can use my format/moment call to get a date with time by using
let eight_hours_ago = format.format({value: moment().subtract(8, 'hours').toDate(), type: format.Type.DATETIME});
which gives me something like ‘16-Oct-2023 02816’ but when I try to use that in my WHERE
I get Invalid or unsupported search
. Anyone know what format I need to use to compare datetime in SuiteQL? For dates it seems to be whatever is used in format module….CD
10/16/2023, 4:12 PMjen
10/16/2023, 4:26 PMjen
10/16/2023, 4:27 PMjen
10/16/2023, 4:27 PMjen
10/16/2023, 4:27 PMWatz
10/16/2023, 5:15 PMCD
10/16/2023, 5:21 PMShai Coleman
10/16/2023, 9:31 PMSELECT to_char(sys_extract_utc(SYSTIMESTAMP), 'YYYY-MM-DD"T"HH24:MI:SS"Z"') AS current_time
jen
10/16/2023, 10:00 PM