I’m working on a ‘currently open?’ routine in support of a user question. My formula takes today’s datestamp in the format 'YYYY-MM-DD'
; appends ' '
plus an opening or closing time ('HHmm'
) based on day-of-the-week, taken from a table; and wraps the whole thing in DATETIME_PARSE()
.
My problem comes when I attempt a comparison with NOW()
. As best I can tell, DATETIME_PARSE()
always returns UTC time, while NOW()
always returns browser time. I haven’t been able to find a way to force either to use the other’s timezone. (I can work around the issue by using DATEADD(NOW(),-7,'hours')
, as I am 7 hours behind UTC — but I can’t figure out how to get the offset automatically. (Oh, wait:
VALUE(DATETIME_FORMAT(SET_TIMEZONE(NOW(),'America/Los_Angeles'),'ZZ'))/100
should probably do it.)
At the moment, is this workaround my best option?