Date function in sikuli

3.2k views Asked by At

I need to get the current date in sikuli script. I am using below code snippet in my script, in which DATE has been hardcoded and that need to change on daily basis to run the script daily. I have tried to find in documentation, but couldn't find there. CODE SNIPPET:

type(Key.TAB + "ABC" + Key.TAB + "06-17-2015" + Key.TAB + Key.TAB + Key.DOWN + Key.TAB + Key.TAB + Key.TAB)
1

There are 1 answers

0
Tenzin On

Have a look at Pythons time, datetime does not work wel with Sikuli
For example:

import time

now = time.strftime('%c')

# Date 
print ('Date: ' + time.strftime('%x'))
# Time 
print('Current time: ' + time.strftime('%X'))
#Current date and time.
print ('Current time %s' % now )

Change the "06-17-2015" by time.strftime('%m-%d-%y').