python - Get local time reflected on PC and not other time zone -


i using python v3.6 current time.

import time current_time = time.strftime("%h:%m:%s %y-%m-%d", time.gmtime()) 

the code works time retrieved other time zones. how retrieve time same reflected on windows 10 clock on pc?

try below. expect gmtime gmt(utc more likely), vs local. see https://docs.python.org/2/library/time.html

    >>> time.strftime("%h:%m:%s %y-%m-%d", time.gmtime())     '03:16:00 2017-08-20'     >>> time.strftime("%h:%m:%s %y-%m-%d", time.localtime())     '13:16:08 2017-08-20 

Comments

Popular posts from this blog

python - Operations inside variables -

Generic Map Parameter java -

arrays - What causes a java.lang.ArrayIndexOutOfBoundsException and how do I prevent it? -