cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
We are making some updates so the Community might be down for a few hours on Monday the 11th of November. Apologies for the inconvenience and thank you for your patience. You can find out more here.

Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

client_modified on filesListFolder entries all in UTC, lose TZ info

client_modified on filesListFolder entries all in UTC, lose TZ info

tiamat
Helpful | Level 6
Go to solution

Hi, I have Automatic Timezone set to ON in my account but all the entries returned from an api call to filesListFolder are in UTC.

When I download a file on Windows then right click -> Properties -> Details I see the following: 

dbhack.PNG

with has the tiem with the correct timezone. Is there a way to get this information from the api call to filesListFolder, preferably as client_modified?

 

Thanks much for your help

1 Accepted Solution

Accepted Solutions

Greg-DB
Dropbox Staff
Go to solution

The "Automatic time zone" setting applies to the Dropbox UI, not the Dropbox API. The Dropbox API uses UTC for file metadata, and API clients can then format times to display them in whatever format and time zone desired.

 

By default, the Dropbox API returns two pieces of time information in the standard file metadata for all files:

client_modified Timestamp(format="%Y-%m-%dT%H:%M:%SZ") For files, this is the modification time set by the desktop client when the file was added to Dropbox. Since this time is not verified (the Dropbox server stores whatever the desktop client sends up), this should only be used for display purposes (such as sorting) and not, for example, to determine if a file has changed or not.
server_modified Timestamp(format="%Y-%m-%dT%H:%M:%SZ") The last time the file was modified on Dropbox.

The 'server_modified' time is always the time that the file was committed to the Dropbox servers. If you control the API client doing the upload in the first place, you can set 'client_modified' to whatever you want, e.g., using filesUpload in the JavaScript SDK by setting the FilesCommitInfo.client_modified. (Based on your 'filesListFolder' reference it seems you're using the JavaScript SDK, but the same functionality exists in the other official SDKs as well as the HTTPS interface itself.) If 'client_modified' is not set by the client, it will be the same as 'server_modified'.

 

From your screenshot though, it looks like you may actually be referring to the datetime information embedded in a photo file in the "EXIF" data. The Dropbox API doesn't return this photo metadata as metadata for the file by default, e.g,. as 'server_modified' or 'client_modified', but you can request some of this metadata separately, by setting FilesGetMetadataArg.include_media_info to true when calling filesGetMetadata. If available, Dropbox will return some of this media metadata in the returned FilesFileMetadata.media_info. For example, the time of the photograph, if available in the EXIF data, will be returned in FilesPhotoMetadata.time_taken.

View solution in original post

2 Replies 2

Greg-DB
Dropbox Staff
Go to solution

The "Automatic time zone" setting applies to the Dropbox UI, not the Dropbox API. The Dropbox API uses UTC for file metadata, and API clients can then format times to display them in whatever format and time zone desired.

 

By default, the Dropbox API returns two pieces of time information in the standard file metadata for all files:

client_modified Timestamp(format="%Y-%m-%dT%H:%M:%SZ") For files, this is the modification time set by the desktop client when the file was added to Dropbox. Since this time is not verified (the Dropbox server stores whatever the desktop client sends up), this should only be used for display purposes (such as sorting) and not, for example, to determine if a file has changed or not.
server_modified Timestamp(format="%Y-%m-%dT%H:%M:%SZ") The last time the file was modified on Dropbox.

The 'server_modified' time is always the time that the file was committed to the Dropbox servers. If you control the API client doing the upload in the first place, you can set 'client_modified' to whatever you want, e.g., using filesUpload in the JavaScript SDK by setting the FilesCommitInfo.client_modified. (Based on your 'filesListFolder' reference it seems you're using the JavaScript SDK, but the same functionality exists in the other official SDKs as well as the HTTPS interface itself.) If 'client_modified' is not set by the client, it will be the same as 'server_modified'.

 

From your screenshot though, it looks like you may actually be referring to the datetime information embedded in a photo file in the "EXIF" data. The Dropbox API doesn't return this photo metadata as metadata for the file by default, e.g,. as 'server_modified' or 'client_modified', but you can request some of this metadata separately, by setting FilesGetMetadataArg.include_media_info to true when calling filesGetMetadata. If available, Dropbox will return some of this media metadata in the returned FilesFileMetadata.media_info. For example, the time of the photograph, if available in the EXIF data, will be returned in FilesPhotoMetadata.time_taken.

tiamat
Helpful | Level 6
Go to solution

thanks for the fast, detailed response.

Need more support?
Who's talking

Top contributors to this post

  • User avatar
    tiamat Helpful | Level 6
  • User avatar
    Greg-DB Dropbox Staff
What do Dropbox user levels mean?