Forum Discussion
Changing when 'Today' starts on the server
- 1 year ago
Hi some_analyst
Use UTCNOW() instead of TODAY() to reflect the current UTC time. Note that UTCTODAY() always returns the UTC datetime at 12:00 AM, regardless of the actual time of day in UTC. Also, you can simply the date format to just FORMAT(SelectedDate, "dddd, dd/mm/yyyy") instead of using CONCATENATE.
Hi some_analyst
Use UTCNOW() instead of TODAY() to reflect the current UTC time. Note that UTCTODAY() always returns the UTC datetime at 12:00 AM, regardless of the actual time of day in UTC. Also, you can simply the date format to just FORMAT(SelectedDate, "dddd, dd/mm/yyyy") instead of using CONCATENATE.
HI danextian I still have a problem with the date, thanks for the tip on the format though.
I used the formula:
Formatted Date Full =
VAR RowDate = dim_date[PK_date] -- From your date table
VAR CurrentUTC12 = NOW() + 0.5 -- Shift current time to UTC+12
VAR CurrentDateUTC12 = INT(CurrentUTC12) -- Strip time, keep just the date
RETURN
IF(
RowDate = CurrentDateUTC12,
"Today",
FORMAT(RowDate, "dddd, dd mmmm")
)
And what happens when I upload the dashboard is the metrics don't add up when I click on the date, and when I click on other dates, 'Today' vanishes
this is when I open the report, metrics below do not add for the day, should be 0
when I click on other dates, the 'Today' is not there:
- danextian1 year ago
Super User
NOW() is different from UTCNOW(). NOW depends on the timezone it is being evaluated.
- some_analyst1 year ago
Helper I
so should I have this:
Formatted Date Full = VAR RowDate = dim_date[PK_date] -- From your date table VAR CurrentUTC12 = UTCNOW() + 0.5 -- Shift current time to UTC+12 VAR CurrentDateUTC12 = INT(CurrentUTC12) -- Strip time, keep just the date RETURN IF( RowDate = CurrentDateUTC12, "Today", FORMAT(RowDate, "dddd, dd mmmm") )