Login

Converting a Flickr Datetime to a Python Datetime

Author:
obeattie
Posted:
February 27, 2007
Language:
Python
Version:
Pre .96
Score:
6 (after 6 ratings)

Though this may not be Django (just basic Python) this kind of thing sure does come in handy! Plus, it's super easy to edit for any datetime format you want to throw at it.

1
2
3
4
5
def flickr_datetime_to_datetime(fdt):
	from datetime import datetime
	from time import strptime
	date_parts = strptime(fdt, '%Y-%m-%d %H:%M:%S')
	return datetime(*date_parts[0:6])

More like this

  1. A wrapper around cache_page making it optional by rixx 2 days, 6 hours ago
  2. Treat empty value on DateRangeFilter as a filter for non filled dates by kmmbvnr 1 month, 1 week ago
  3. Django Settings Assignment Expressions aka Walrus Operator example by webology 2 months, 1 week ago
  4. codigo alto nivel by MrRocklion 4 months, 1 week ago
  5. Load template from specific app by Krzysiek555 4 months, 4 weeks ago

Comments

Please login first before commenting.