Cut the Clutter: Test Ignore Files Feature - sign up to become a beta tester here.
Forum Discussion
andrew r.46
9 years agoNew member | Level 2
V2 getServerModified date format
I'm transitioning to v2 on Android. I use the modified date and time to know when is a good time to backup again.
In the migration documentation it says:
Date formats
- v1: All dates in the API are strings in the following format: "Sat, 21 Aug 2010 22:31:20 +0000"
- v2: All dates are strings in the ISO 8601 "combined date and time representation" format. For example, "2007-04-05T14:30".
When I use:
SearchResult searchResult = dbxClientV2.files().search("", KEY_WEEKLY_FILE_NAME); FileMetadata fileMeta = (FileMetadata) searchResult.getMatches().get(0).getMetadata(); fileMeta.getServerModified().toString()
I'm getting the following format:
Wed Apr 26 17:13:03 EDT 2017
I can format this with relative ease, but I'm expecting the ISO 8601 format and I'm concerned it will change at some point without warning, or perhaps I'm doing something wrong?
The documentation you quoted is referring to the format sent by the API in the HTTP response itself. That format is stable.
When using the Java SDK, the responses are translated into native objects for you. For example, FileMetadata.getServerModified returns a Java Date object. The Java Date.toString method by default does give a date string of the format "dow mon dd hh:mm:ss zzz yyyy". The stability of that format is up to the stability of Java. You can alteratively format it however you want, e.g., using DateFormat.
2 Replies
Replies have been turned off for this discussion
- Greg-DB9 years ago
Dropbox Community Moderator
The documentation you quoted is referring to the format sent by the API in the HTTP response itself. That format is stable.
When using the Java SDK, the responses are translated into native objects for you. For example, FileMetadata.getServerModified returns a Java Date object. The Java Date.toString method by default does give a date string of the format "dow mon dd hh:mm:ss zzz yyyy". The stability of that format is up to the stability of Java. You can alteratively format it however you want, e.g., using DateFormat.
- andrew r.469 years agoNew member | Level 2Fantastic, thank you very much
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.6,039 PostsLatest Activity: 2 days ago
The Dropbox Community team is active from Monday to Friday. We try to respond to you as soon as we can, usually within 2 hours.
If you need more help you can view your support options (expected response time for an email or ticket is 24 hours), or contact us on X or Facebook.
For more info on available support options for your Dropbox plan, see this article.
If you found the answer to your question in this Community thread, please 'like' the post to say thanks and to let us know it was useful!