Possible Bug with Datetime Math Operation

When we make math expression with Datetime type it’s like this:
[Datetime] + "005:30:30" OR [Datetime] - "005:30:30"
It’s legit and the part that we add to the datetime value is actually a text. Correct? From this point, basically I should be able to construct the addition/subtraction part of the expression simply with either TEXT() or CONCATENATE() expression or event with using an amperstand (&) operator.

I have a case, where I need to add a total minutes (number) figure to a Timestamp value. I have constructed 2 expressions both ended up where the second argumental expression resulting a blank value:


Expression#1


[TIMESTAMP] + RIGHT("00"&((FLOOR(TOTALMINUTES([TIMESTAMP] - UTCNOW()) + USERTZOFFSET())/60)*-1),3)&":00:00"

Expression#2


[TIMESTAMP] + CONCATENATE("""",RIGHT("00"&((FLOOR(TOTALMINUTES([TIMESTAMP] - UTCNOW()) + USERTZOFFSET())/60)*-1),3)&":00:00","""")

Both expressions seem absolutely legit:

However, the second argument of the math operation evals to blank therefore no addition is made.
Note: When tested, the second part of the expression correctly produces the string btw

Could this be a bug or am I doing/considering/mis-interpreting something wrong?

@Steve, @Aleksi what do you think?

Solved Solved
0 2 230
1 ACCEPTED SOLUTION

Steve
Platinum 4
Platinum 4

My interpretation/understanding is that raw/literal Date, DateTime, Duration and Time values are recognized as such, but expressions that produce a textual value that appear to be are not. You’ll need to use DATE(), DATETIME(), or TIME() to convert the constructed textual value to the desired type.

  • "00:00:00": Time value
  • "00" & ":00:00": Text value
  • TIME("00" & ":00:00"): Time value

View solution in original post

2 REPLIES 2

Steve
Platinum 4
Platinum 4

My interpretation/understanding is that raw/literal Date, DateTime, Duration and Time values are recognized as such, but expressions that produce a textual value that appear to be are not. You’ll need to use DATE(), DATETIME(), or TIME() to convert the constructed textual value to the desired type.

  • "00:00:00": Time value
  • "00" & ":00:00": Text value
  • TIME("00" & ":00:00"): Time value

@Steve
Thank you very much for the insight, highly appreciated. Enclosing the second argumentative expression with TIME() expression did the trick.
[TIMESTAMP] + (TIME(RIGHT("0"&((FLOOR(TOTALMINUTES([TIMESTAMP] - UTCNOW()) + USERTZOFFSET())/60)*-1),2)&":00:00") - "00:00:00")

Top Labels in this Space