OiO.lk Community platform!

Oio.lk is an excellent forum for developers, providing a wide range of resources, discussions, and support for those in the developer community. Join oio.lk today to connect with like-minded professionals, share insights, and stay updated on the latest trends and technologies in the development field.
  You need to log in or register to access the solved answers to this problem.
  • You have reached the maximum number of guest views allowed
  • Please register below to remove this limitation

How to check if date is in UTC format using pytz or datetime?

  • Thread starter Thread starter Jill
  • Start date Start date
J

Jill

Guest
I'm using the pytz module to translate a date from America/Los_Angeles timezone to UTC using the code below:

Code:
TZ = 'America/Los_Angeles'
from = pytz.timezone(TZ)
utc = from.localize(original_date).astimezone(pytz.utc)

Now, I want to test if the UTC value is actually in UTC format or not. How to do that with pytz or datetime ?
<p>I'm using the pytz module to translate a date from America/Los_Angeles timezone to UTC using the code below:</p>
<pre><code>TZ = 'America/Los_Angeles'
from = pytz.timezone(TZ)
utc = from.localize(original_date).astimezone(pytz.utc)
</code></pre>
<p>Now, I want to test if the UTC value is actually in UTC format or not. How to do that with pytz or datetime ?</p>
 

Latest posts

Top