⊗pyPmTmSTEG 195 of 208 menu

Getting epoch format from struct_time in Python

To get the epoch seconds from the struct_time object again, you can use the mktime method of the time module.

Let's get a struct_time object using the gmtime method:

now = time.time() st_time = time.gmtime(now)

Then we transform struct_time using the mktime method:

res = time.mktime(st_time) print(res) # the number of seconds
English
AfrikaansAzərbaycanБългарскиবাংলাБеларускаяČeštinaDanskDeutschΕλληνικάEspañolEestiSuomiFrançaisहिन्दीMagyarՀայերենIndonesiaItaliano日本語ქართულიҚазақ한국어КыргызчаLietuviųLatviešuМакедонскиMelayuမြန်မာNederlandsNorskPolskiPortuguêsRomânăРусскийසිංහලSlovenčinaSlovenščinaShqipСрпскиSrpskiSvenskaKiswahiliТоҷикӣไทยTürkmenTürkçeЎзбекOʻzbekTiếng Việt
We use cookies for website operation, analytics, and personalization. Data processing is carried out in accordance with the Privacy Policy.
accept all customize decline