Encoding datetime for JSON consumers like YUI

1
2
3
4
# Unlike datetime.isoformat(), this works in UTC and has the trailing Z which is
# required by JSON parsers such as YAHOO.lang.JSON.stringToDate:

time.strftime('%Y-%m-%dT%H:%M:%SZ', date.utctimetuple())

More like this

  1. JSON encode ISO UTC datetime by japerk 5 years ago
  2. YUI editor for flatpages inside admin interface by nnrcschmdt 6 years, 1 month ago
  3. Client-side Django-style date & time string formatting by robbie 7 years, 1 month ago
  4. YUI Autocomplete by pigletto 6 years, 8 months ago
  5. Display arbitrary models by bjornkri 5 years, 9 months ago

Comments

(Forgotten your password?)