changing a variable when date changes

Asked by john gonale on 2018-04-23

im new to coding, and am slowly learning how to use sikuli by writing a simple bot for web game. i am trying to change a variable based on date change, an example of what im trying to do:

global currentdate
global newdate
global datechanged

get date and set the variable currentdate to it

datechanged = False
loopage = True

while loopage:
 get date or time and set the var newdate to it

 if currentdate != newdate:
  currentdate = newdate
   datechanged = True

datechanged is then called in a different function that handles an event that can only be done once a day, once its done, it sets datechanged back to false, untill the day actually changes again, and the value gets set back to true

is there a clean way to get just the day for comparison?

Question information

Language:
English Edit question
Status:
Solved
For:
Sikuli Edit question
Assignee:
No assignee Edit question
Solved by:
RaiMan
Solved:
2018-04-23
Last query:
2018-04-23
Last reply:
2018-04-23
john gonale (erojiji) said : #1

forgot to mention, im using just the SikulixIDE version 1.1.1, with no librabry's added

Best RaiMan (raimund-hocke) said : #2

it is just Python language.
have a look at the date/time standard functions:
https://docs.python.org/2/library/datetime.html

john gonale (erojiji) said : #3

Thanks RaiMan, that solved my question.

john gonale (erojiji) said : #4

that is perfect date.weekday gives me exactly what i was looking for , a simple base number i can easily check to see if it has changed