python - time.strftime() not updaing -


i trying time when button pushed, going have few pushes without starting , calling time module. in ipython, tested out code, , time not updating

import time t = time.strftime("%b-%d-%y @ %i:%m%p") print(t) #do else little t = time.strftime("%b-%d-%y @ %i:%m%p") print(t) 

it gives me same time

even if put in time tuple such as:

lt = time.localtime(time.time()) t = time.strftime("%b-%d-%y @ %i:%m%p", lt) print(t) 

i same time

even if wait, , execute code again (in ipython), gives me same time.

time.time() give me new time every time though

i don't know if doing in ipython (i'm testing code before put in python file) matters

what doing wrong??

you using %m @ %i:%m%p format "minutes", means month in decimals. try capital %minstead minutes.

so,

time.strftime("%b-%d-%y @ %i:%m%p") 

see strftime documentation format directives.


Comments

Popular posts from this blog

unity3d - Rotate an object to face an opposite direction -

angular - Is it possible to get native element for formControl? -

javascript - Why jQuery Select box change event is now working? -