How do you calculate the difference between logging in and logging out using Sql
Hi Andrew,
On your aggregate, you can add a new attribute (using the New attribute button) and make use of OutSystems built-in functions DiffDays, DiffHours, DiffMinutes or DiffSeconds to get the difference between two date times. Something like in the example below where I use the DiffHours function:
Hope it helps.
Regards,João
Great, but I need function calculat different between date time 1 and date tmie 2 using sql queries
In Advanced SQL, the syntax varies if you're using SQL Server, MySQL or Oracle.
For instance, if you're using SQL Server, the syntax is DATEDIFF( date_part , start_date , end_date) where the date_part defines if you're looking for the difference in days, minutes, etc.
For instance,
SELECT DATEDIFF(hh, {User_Extendend}.[LoginStartDate], {User_Extended}.[LoginEndDate]) FROM {User_Extended} would give you the difference in hours.
Here you can find examples and the possible values for the date_part.
Regards,
João
thanks
João Marques