How to add timestamp?

i create a gui at plugins tab and i try to log consigment trade logs there. How can i add timestamp?

QtBind.append(gui,lstCons,"[Consignment] Hunter trade will start at 10 minutes")

Change the format to whatever you want

from time import localtime, strftime

date = strftime("%d/%m %I:%M:%S %p", localtime())
QtBind.append(gui,lstCons,"[%s][Consignment] Hunter trade will start at 10 minutes" %date)

it works, thanks.

It logs same date what plugin loaded. 3

You’ve put it in the wrong spot then. You need to put it inside whatever function is being called to log this event. date = needs to be called every time you append the list, not just when the plugin loads.

Okay i did it:
date ='%H:%M:%S')

Your issue is you put it in the wrong spot, not the date code itself.

1 Like