Guest User

Untitled

a guest
Jul 17th, 2019
71
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. def encodedate (day, month, year):
  2. x = 0
  3. if month > 0 and month <=12:
  4. x = (x & 0x0FFFFFFF) | ((month - 1) << 28)
  5. else:
  6. return -1
  7.  
  8. if day <= 31 or day > 0:
  9. x = (x & 0x0FFFFFF) | (day << 23)
  10.  
  11. else:
  12. return -1
  13.  
  14. if year > 0 and year <= 2**23 -1:
  15. x = (x & 0x7FFFF) | year
  16. return x
  17.  
  18. print(encodedate(5,5,2017))
RAW Paste Data