How can I get the Date & Time of a Message rec...
# suiteql
b
How can I get the Date & Time of a Message record that matches what it shows in the UI?
I'm getting closer. I've discovered that the time zone seems to be UTC. I tried converting that to the user's time zone, but it's still off by one because of daylight savings time. I tried replacing TZD with TZR, but that threw an error.
c
@burkybang Make sure you're getting the user's time zone and not the server's time zone - from what I recall, SYS is the server time
b
Okay, sure. In this case the user and company have the same time zone. How can I get the user's time zone abbreviation?
c
The server time zone is where Netsuite's servers are, independent of company or user location. Try
CURRENT_DATE
for the user. More here.
b
Okay, that works for the user's time zone. Thanks. Now I just need to solve getting the date/time from that field in the same time zone as the UI.
Right now, I have figured out how to get the time zone abbreviation, but it returns EDT, which is correct; however, when used to convert the time, it does not match the UI.
c
How are you using it to convert the time?
b
See my screenshot in my comment above. I'm using NEW_TIME()
👍 1
c
It might be related to EST vs EDT - Mar 10 was before the switch from EST to EDT. Can you use
FROM_TZ
instead?
b
Ohh, true
c
I had a suspicion DST was related, and a Google turned this up.
b
Doesn't FROM_TZ() go the opposite direction? It converts a timestamp from a time zone to GMT
I need the other way around
I think I figured it out
Fixed bug with am/pm
👍 1
c
Glad to hear you got it 🎉 @burkybang