Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def encodedate (day, month, year):
- x = 0
- if month > 0 and month <=12:
- x = (x & 0x0FFFFFFF) | ((month - 1) << 28)
- else:
- return -1
- if day <= 31 or day > 0:
- x = (x & 0x0FFFFFF) | (day << 23)
- else:
- return -1
- if year > 0 and year <= 2**23 -1:
- x = (x & 0x7FFFF) | year
- return x
- print(encodedate(5,5,2017))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement