get time difference in seconds for time referring to another timezone
<p>I intend to find the time difference between two time variables in seconds. The issue here is that I am referring to time in a different zone. I have managed to find a solution, but it is a mix of pandas.datetime function and python datetime library. I guess, the objective can be achieved with just pandas/numpy alone and with fewer lines of code. below is my code, appreciate any guidance on how can i achieve the final_output more efficiently.</p>

<pre><code>import pandas as pd
from datetime import timedelta

local_time = pd.to_datetime('now').tz_localize('UTC').tz_convert('Asia/Dubai')

t1 = timedelta(hours=local_time.now('Asia/Dubai').hour, minutes=local_time.now('Asia/Dubai').minute)

t2 = timedelta(hours=9, minutes=14)

final_output = (t2 - t1).seconds
</code></pre>

<p>You may want to convert both times to UTC, then find the difference. Programmers usually like to work with UTC until the time reaches the front end.</p>

python datetime pandas numpy timedelta