Skip to content

Instantly share code, notes, and snippets.

@drbh
Created August 5, 2020 17:04
Show Gist options
  • Save drbh/f5cd7d6ec5327b8eee77e73404adff6f to your computer and use it in GitHub Desktop.
Save drbh/f5cd7d6ec5327b8eee77e73404adff6f to your computer and use it in GitHub Desktop.
When you only wanna update users on even weeks of the year
import datetime
# get the week of the year
week_number = datetime.datetime.now().isocalendar()[1]
print(f"Its the {week_number} week of the year")
# this is True every other week
should_update_users = week_number % 2 == 0
if should_update_users:
print("update users")
else:
print("dont update users")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment