0

I need to send a querystring parameter to our API server which is taking times in GMT format. I am a bit confused about what values I need to send during the summertime, since the dates are in GMT format.

Let's assume we are in London (UK), it's 3PM, and it's the 15th of May 2016.

Is the correct date value:

?date=2016-05-15T15:00:00Z

or

?date=2016-05-15T15:00:00+01:00

or

?date=2016-05-15T16:00:00Z (assuming I always want to use the Z "Zulu Time")
MeV
  • 3,761
  • 11
  • 45
  • 78

1 Answers1

1

Since London is in BST on that date, then 2016-05-15T15:00:00+01:00 would be the most fully qualified correct form.

If you were to normalize that to UTC, then it would become 2016-05-15T14:00:00Z. Z is equivalent to +00:00, so you have to adjust the hour by the inverse of the original offset.

2016-05-15T15:00:00Z is incorrect, as that is an hour later.

As to which of the two correct forms are more correct for your particular API, there's no way to answer that as you gave no details about how the API is designed, what language it's implemented in, what code is parsing the input, etc. In many cases, either would be accepted. However if the API requires to know local time as well as the universal time, then only the 2016-05-15T15:00:00+01:00 for would convey both.

Also, recognized that there's no such thing as "GMT format". GMT is a time zone, equivalent to UTC+00:00. What you actually have here is a string in ISO8601 extended format, also specified under RFC3339. This is commonly said to be the "ISO format".

Community
  • 1
  • 1
Matt Johnson-Pint
  • 230,703
  • 74
  • 448
  • 575