1

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"">
Craig
  • 4,268
  • 4
  • 36
  • 53

3 Answers3

4

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.

Burcu Dogan
  • 9,153
  • 4
  • 34
  • 34
  • This looks like a bug though, we should allow `T17:08:57:00`, although we dont. – Burcu Dogan Jul 13 '13 at 22:28
  • [rfc 3339 is clear](http://tools.ietf.org/html/rfc3339#section-5.6): `.` is the only option for the fractions of a second separator. – jfs Nov 26 '13 at 01:06
1

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

2013-06-13T20:19:24.000001+00:00
Craig
  • 4,268
  • 4
  • 36
  • 53
  • At [foo must be an RFC 3999 date-time](http://feed2.w3.org/docs/error/InvalidRFC3339Date.html) the first common error listed is forgetting time-zone information(as you did). – Bakuriu Jul 13 '13 at 12:49
  • I did initially provide it, but Google complained about it, so I took it out. It seems that both microseconds and tzinfo are required. What is odd is that the isoformat() method omits microseconds when zero. If RFC 3339 requires microseconds, why omit them? – Craig Jul 13 '13 at 12:57
1

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

Community
  • 1
  • 1
vujke
  • 483
  • 7
  • 14