Any tips for getting a `datetime` field back in a ...
# general
b
Any tips for getting a
datetime
field back in a search, but in an ISO format (specifically with the timezone info)?
c
Formula (text) with
TO_CHAR(CAST({lastmodifieddate} AS TIMESTAMP WITH LOCAL TIME ZONE), 'YYYY-MM-DD, HH24:MI:SS TZD')
Adjust the format as necessary
b
It seems to break when I have
:
in the formula
c
I just copied that out of a search that I created in order to help you. I don't know what else to say
b
This is helpful. I'll continue to fiddle with it. Thanks.
d
One I use: TO_CHAR(TO_TIMESTAMP_TZ(TO_CHAR({created},'YYYY/MM/DD HH24MISS'), 'YYYY/MM/DD HH24MISS TZH'), 'YYYY/MM/DD HH24MISS TZH:TZM')
b
I tracked down my issue with
:
It was a bug in the helper utility I have around running searches. Here was my winning solution:
Copy code
formulatext:TO_CHAR(CAST({lastmodifieddate} AS TIMESTAMP WITH LOCAL TIME ZONE), 'YYYY-MM-DD\"T\"HH24:MI:SS')||TZ_OFFSET(SESSIONTIMEZONE)
yields:
2021-07-19T14:51:09-04:00
Thanks @CD !