| http://developer.ebay.com/DevZone/XML/docs/WebHelp/DataTypes-Time_Values.html | |
| Appendices > Data Types > Time Values | |
Time Values
This section covers the following topics:
Why Do Time Values Seem Inconsistent with the Web Site?
Converting Between UTC/GMT and Local Time
Converting Between Pacific Time (PST/PDT) and a Local Time
Why Do Time Values Seem Inconsistent with the Web Site?
Depending on your location and your development environment, date-time values returned from eBay may appear to be different from the time stamps you see on the eBay.com Web site and the Sandbox Web site.
The eBay.com Web site displays time values in a local time zone or in Pacific Time. For example, the US site uses Pacific Time. However, in most cases, the eBay Platform time-stamps all events and transactions in Universal Coordinated Time (UTC), also known as Greenwich Mean Time (GMT). So, unless otherwise specified for a particular field or call (e.g., GetSearchResults uses Pacific Time with compatibility levels lower than 387), all date-time values returned from eBay are in GMT (specifically, the Zulu format), not in the time zone displayed on the Web site (see Table A-1).
Hours are in the 24-hour format (e.g., 2:00:00pm is shown as 14:00:00).
ISO 8601 Date and Time FormatsThe World Wide Web Consortium (W3C)
For simplicity, we refer to UTC/GMT/Zulu time "GMT" in this documentation.
About GMT
By international convention, GMT is used as the basis for determining the official time in all time zones around the world. GMT express the time of day on Earth at 0˚ longitude (the Greenwich Meridian). Historically, GMT is associated with Greenwich, England. Unlike many local time zones, GMT does not switch to daylight-saving time in the spring.
Converting Between UTC/GMT and Local Time
If you prefer to display or work with date-time values in a particular time zone, your application needs to handle the conversion between GMT and that time zone.
Using Third-Party Libraries
Some programming languages include classes, functions, modules, or other constructs for converting between a local time and GMT (or times in any two zones) and adjusting for daylight-saving time.
Some development environments automatically convert SOAP
dateTimevalues to your local system time. In this case, you would only need to convert a time value if you want to display a value other than your local system time, or if you need to convert time values in order to work with the XML API.Performing the Conversion Yourself
To program the conversion to or from GMT by using your own algorithm, you need to know the GMT offset and daylight-saving time behavior in the local time zone. (Two locations with the same GMT offset might not use the same daylight-saving time rules.) The offset is the difference between the current time in the local time zone and GMT. GMT does not switch to daylight-saving time, so if the local time zone does, the offset will change twice a year. Depending on the country the user is in, daylight-saving time starts in March or April and lasts through September or October.
Information about GMT offsets for different time zones is widely available. For example, you can search for "Time Zone Guide GMT" on the Internet. Your computer's clock application may also list GMT offsets for different time zones.
West of the Greenwich Meridian: If the local time zone is west of the Greenwich Meridian, the offset is negative. For example, when it is 17:00:00 GMT (5:00 PM) GMT, it is 09:00:00 PST (9:00 AM Pacific Standard Time) in California, US during winter. So, the GMT offset for PST is -8:00.
To convert from GMT to PST and back, you use these formulas:
PST = GMT - 8 hours
GMT = PST + 8 hours
PST = 17:00:00 - 8:00:00 = 09:00:00
GMT = 09:00:00 + 8:00:00 = 17:00:00
During Pacific Daylight Time (PDT), the GMT offset for PDT is -7:00 (-8 + 1):
PDT = GMT - 7 hours
GMT = PDT + 7 hours
PDT = 17:00:00 - 7:00:00 = 10:00:00
GMT = 10:00:00 + 7:00:00 = 17:00:00
East of the Greenwich Meridian: If the local time zone is east of the Greenwich Meridian, the offset is positive. For example, when it is 17:00:00 (5:00 PM) GMT, it is 03:00:00 AEST (3:00 AM Australian Eastern Standard Time) the next morning in Canberra, Australia. So, the GMT offset for AEST is +10:00.
To convert from GMT to AEST and back, you use these formulas:
AEST = GMT + 10 hours
GMT = AEST - 10 hours
AEST = 17:00:00 + 10:00:00 = 03:00:00
GMT = 03:00:00 - 10:00:00 = 17:00:00
During Australian Eastern Daylight Time (AEDT), the GMT offset for AEDT is +11:00 (+10 + 1):
AEST = GMT + 11 hours
GMT = AEST - 11 hours
AEST = 17:00:00 + 11:00:00 = 04:00:00
GMT = 04:00:00 - 11:00:00 = 17:00:00
Converting Between Pacific Time (PST/PDT) and a Local Time
If you need to convert Pacific Time values to time values for another time zone, you can use one of these approaches:
- Use the formulas described in Converting Between UTC/GMT and Local Time to convert from Pacific Time to GMT and then from GMT to the corresponding time in the local time zone.
- Determine the offset between Pacific Time and the local time and convert the value in one step.
| Appendices > Data Types > Time Values | |
| http://developer.ebay.com/DevZone/XML/docs/WebHelp/DataTypes-Time_Values.html | |
| © 2004–2009 eBay Inc. All rights reserved. | Version 623 |