1

Django REST_FRAMEWORK has a setting for the date format, e.g for timestamp in seconds:

REST_FRAMEWORK = {
    'DATETIME_FORMAT': '%s',
}

so my API output is for instance:

{"creation_date":"1610700530"}

How would I tell it to output a timestamp in milliseconds? E.g.:

{"creation_date":"1610700530000"}
1
  • yes you are right, thank you. the last answer is an answer to my question - i can use 'DATETIME_FORMAT': '%s000'
    – Nik
    Jan 16, 2021 at 7:09

1 Answer 1

1

I think I found an answer, the option would be:

REST_FRAMEWORK = {
    'DATETIME_FORMAT': '%s%03d',
}

Not the answer you're looking for? Browse other questions tagged or ask your own question.