In this example, you can observe that the datetime output show the time approx 5 hours and 30 minutes before the time in the previous example. from datetime import datetimeĭatetime_obj=datetime.utcfromtimestamp(epoch) If you want to get the UTC time from the timestamp, you can use the utcfromtimestamp() instead of the fromtimestamp() method as shown below. The above approach will give you time according to the time zone on your machine. In this example, we have converted the epoch 123456789 to datetime value using the fromtimestamp() method.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |