Createddate gives a datetime value in the transact...
# suiteql
r
Createddate gives a datetime value in the transaction record. And as far as ik it always gives in the PST time zone, no matter where the company or its srcer is situated. Pls correct me if I am wrong. How can I convert that value to EST time zone.
a
Copy code
SELECT
    TO_CHAR(current_timestamp at time zone 'US/Eastern', 'YYYY-MM-DD HH:MI:SS' ),
    TO_CHAR(current_timestamp, 'YYYY-MM-DD HH:MI:SS' )
FROM
    dual
The following resource has a lot of info on dates: https://timdietrich.me/blog/netsuite-suiteql-dates-times/
s
For some reason the query above returns
UNEXPECTED_ERROR
when running through the SuiteQL REST API. It works fine through the SuiteQL Query Tool. The workaround is to use some function around the timezone string, e.g.
SELECT TO_CHAR(current_timestamp AT TIME ZONE TO_CHAR('US/Eastern'), 'YYYY-MM-DD HH:MI:SS') FROM DUAL
Alternatively, you can convert it to UTC, and then convert it to the correct timezone outside SuiteQL, e.g.
SELECT to_char(sys_extract_utc(systimestamp), 'YYYY-MM-DD"T"HH24:MI:SS"Z"')
r
Why this is giving error. Getting error in SuiteQL Query Tool
Copy code
SELECT
    TO_CHAR(soTrans.createddate at time zone 'US/Eastern', 'YYYY-MM-DD HH:MI:SS' )
FROM
    transaction AS soTrans
WHERE
    soTrans.id IN (13108776)
This seems to give no error, in suiteQL query tool. IDK why we get the error in opposite.
Copy code
To_char(sys_extract_utc(soTrans.createddate) at time zone 'US/Eastern', 'MM/DD/YYYY HH24:MI:SS')
Thanks both of you.
301 Views