Welcome to collectivesolver - Programming & Software Q&A with code examples. A website with trusted programming answers. All programs are tested and work.

Contact: aviboots(AT)netvision.net.il

Buy a domain name - Register cheap domain names from $0.99 - Namecheap

Scalable Hosting That Grows With You

Secure & Reliable Web Hosting, Free Domain, Free SSL, 1-Click WordPress Install, Expert 24/7 Support

Semrush - keyword research tool

Boost your online presence with premium web hosting and servers

Disclosure: My content contains affiliate links.

39,938 questions

51,875 answers

573 users

How to print the time struct components in Python

1 Answer

0 votes
import time

def print_time_struct(ts):         
    print('tm_year :', ts.tm_year)         
    print('tm_mon :', ts.tm_mon)         
    print('tm_mday :', ts.tm_mday)         
    print('tm_hour :', ts.tm_hour)         
    print('tm_min :', ts.tm_min)         
    print('tm_sec :', ts.tm_sec)         
    print('tm_wday :', ts.tm_wday)         
    print('tm_yday :', ts.tm_yday)         
    print('tm_isdst:', ts.tm_isdst)
      
      
print_time_struct(time.gmtime())

      
         
'''
run:

tm_year : 2019
tm_mon : 6
tm_mday : 2
tm_hour : 19
tm_min : 12
tm_sec : 0
tm_wday : 6
tm_yday : 153
tm_isdst: 0
            
'''

 



answered Jun 2, 2019 by avibootz

Related questions

1 answer 98 views
1 answer 128 views
2 answers 242 views
1 answer 258 views
1 answer 91 views
...