Skip to content

Instantly share code, notes, and snippets.

@ksysctl
Created January 10, 2014 00:51
Show Gist options
  • Select an option

  • Save ksysctl/8345017 to your computer and use it in GitHub Desktop.

Select an option

Save ksysctl/8345017 to your computer and use it in GitHub Desktop.
Get objects by specific day
# created_at is a DateTime field
from datetime import datetime
today = datetime.now()
objs = MyModel.objects.filter(
created_at__day=today.day,
created_at__month=today.month,
created_at__year=today.year
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment