Generated comlumn datetime calculation

How do you create a generated column to calculate duration between 2 datetime fields?

It is not end_time - start_time nor does it work when I multiply by seconds or miliseconds.

Hello @Andreas_Marinopoulos

First of all, I should pay attention to “x” in your calculations. If you want to multiply, you can use - *

You also could use “DATEDIFF” function.

Additional info about generated columns:

Regards, Dima.

This is great, it gives me what I need.

My use case is as follows. A certain column of the table gives a datetime variable, and I want to add a generated column that displays the same date in a different timezone. My problem now is that the timezone I am looking for is in a related table. Can I use data from a related table in my generated columns?

Short answer - no. We can use data only from current row in data table.