Question

I am trying to synchronise a file, but the drive is complaining about the date format. It says in the documentation that it uses RFC 3339 date formats, but this is the error I am getting when passing it a valid ISO RFC 3339 compliant date:

<HttpError 400 when requesting https://www.googleapis.com/drive/v2/files?alt=json returned "Invalid value for: Invalid format: "2013-06-13T20:19:24.000001" is too short">

The date is included, which I have artificially set a microsecond of 1, since I initially thought that Google Drive was being pedantic about the microsecond not being present. However, still get the same error whether the microsecond is present or not. I have also tried setting a UTC timezone, which appends +00:00. But then Google complains about the timezone offset being present.

Does anybody know what Google are expecting an RFC 3339 date format to look like?

Update: Thought I'd show the other format examples:

<HttpError 400 when requesting https://www.googleapis.com/drive/v2/files?alt=json returned "Invalid value for: Invalid format: "2013-06-13T20:19:24" is too short">

<HttpError 400 when requesting https://www.googleapis.com/drive/v2/files?alt=json returned "Invalid value for: Invalid format: "2013-06-13T20:19:24+00:00" is malformed at "+00:00"">
Was it helpful?

Solution

Use any RFC 3339 representation but avoid : as a separator for seconds. Instead, use ..

2013-07-13T17:08:57.52Z and 2013-07-13T17:08:57.52-00:00 are working samples.

OTHER TIPS

The one date format I hadn't tried just worked:

2013-06-13T20:19:24.000001+00:00

Here are some RFC 3339 examples of Internet date/time format:

  • 1985-04-12T23:20:50.52Z
  • 1996-12-19T16:39:57-08:00
  • 1990-12-31T23:59:60Z
  • 1990-12-31T15:59:60-08:00
  • 1937-01-01T12:00:27.87+00:20

RFC3339

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top