Support for Unix Timestamp

250 views
Skip to first unread message

Anoop Malav

unread,
Jan 4, 2014, 2:29:15 AM1/4/14
to django-res...@googlegroups.com
Hi all,

In settings datetime can be configured to parse and render in 'iso-8601' and python strftime formats.
How unix timestamp can be used?

Thanks.

Tom Christie

unread,
Jan 6, 2014, 4:06:55 AM1/6/14
to django-res...@googlegroups.com
Take a look at implementing custom serializer fields, here... http://django-rest-framework.org/api-guide/fields#custom-fields

Anoop Malav

unread,
Jan 7, 2014, 1:15:50 AM1/7/14
to django-res...@googlegroups.com
Thanks Tom,

it worked.

Also I am using django-filter package for filtering. So I need to convert timestamp here too.
I did override __init__ method of django_filters.FilterSet to achieve this. And I'm modifying querydict (qd = args[0].copy()) before I pass it to super class.
Is it the right way to that?

One more question, What would you prefer to use between 'iso-8601' and unix-timestamp? And Why?

Tom Christie

unread,
Jan 7, 2014, 4:13:31 AM1/7/14
to django-res...@googlegroups.com
> What would you prefer to use between 'iso-8601' and unix-timestamp?

iso-8601 since it's human readable, more obviously a timestamp, can represent timezone information, and can represent dates as well as datetimes.
Reply all
Reply to author
Forward
0 new messages