Difference in number of minutes between 2 timestamps
Posted on 2016-11-21
I'm using the below sql in my query and the output I get on my report is as shown in the output below:
Both the created_date and m.act_onblk_datt_bu are timestamps that i'm coverting to America/New_York time.
FROM_TZ(min(q.created_date) over (partition by k.car_id,m.fll_id), 'Europe/London') AT TIME ZONE 'America/New_York'
- min(m.act_onblk_datt_bu) over (partition by k.car_id, m.fll_id) AT TIME ZONE 'America/New_York' as Number_of Mins
SQL query output format:
Number of Mins
I would like to format the output on my report to show the returned value as the number of minutes only. Based on this example I would like to display '3' minutes
Ultimately what I'm trying to achieve is the difference in number of minutes between 2 timestamps regardless of whether the difference runs into days, hours or just minutes. Rounding up or down to the nearest minute would be fine.
I am a newbie to SQL and have tried to round the value, I have also tried using to_number but I cannot get these to work to get the output format I desire. Any help you can provide will be fantastic.
Please remember I'm an amateur so I'd really appreciate it if you could keep things simple for me.