API General Update Request | Include TimeZone on all datetimes

For requests or help with our API
Post Reply
rinse-dental
Posts: 16
Joined: Wed Apr 06, 2022 12:04 pm

API General Update Request | Include TimeZone on all datetimes

Post by rinse-dental » Mon May 16, 2022 10:07 am

Would love to see timezone including on all dates, including DateTStamp, serverDateTime, and especially AptDateTime

User avatar
jordansparks
Site Admin
Posts: 5694
Joined: Sun Jun 17, 2007 3:59 pm
Location: Salem, Oregon
Contact:

Re: API General Update Request | Include TimeZone on all datetimes

Post by jordansparks » Mon May 16, 2022 7:25 pm

Including it in the date field seems like a breaking change. On the other hand, everyone is probably parsing the date with a library that could easily handle the change. Still, I think we'll need to make it an option that you intentionally turn on.
Jordan Sparks, DMD
http://www.opendental.com

SLeon
Posts: 168
Joined: Mon Mar 01, 2021 11:00 am

Re: API General Update Request | Include TimeZone on all datetimes

Post by SLeon » Thu May 19, 2022 9:48 am

The addition of time zone information has been added to our development list. The output string will be in "yyyy-MM-dd HH:mm:sszzz" format, and so will appear as "2022-05-19 09:42:45-07:00". Our plan is to toggle on the time zone information with a URL parameter. This will allow developers to opt into this new format and preserve existing behavior/prevent a breaking change.

SLeon
Posts: 168
Joined: Mon Mar 01, 2021 11:00 am

Re: API General Update Request | Include TimeZone on all datetimes

Post by SLeon » Fri Jun 17, 2022 3:58 pm

In an effort to support many different type of DateTime formats, we have added a new URL parameter for API requests called DateTimeFormatString. This parameter is available for all API requests and will allow developers to fully customize the way all returned DateTimes (dates in "yyyy-MM-dd HH:mm:ss" format) are displayed.

The new DateTimeFormatString can be set to any format string found here https://docs.microsoft.com/. Common examples include:
  • Time Zones: yyyy-MM-dd HH:mm:ss zzz (2022-06-17 15:46:45 -7:00)
  • Day-Month-Year: dd-MM-yyyy HH:mm:ss (17/06/2022 15:46:45)
  • 12-Hour times: yyyy-MM-dd hh:mm:ss tt (2022-06-17 03:46:45 PM)
  • Long versions: dddd, MMMM d, yyyy HH:mm:ss (Friday, June 17, 2022 15:46:45)
  • Other separating characters: MM/dd/yy HH:mm:ss (06/17/22 15:46:45)
An example request would look like:

Code: Select all

GET /patients/Simple?DateTimeFormatString=dd/MM/yyyy HH:mm:ss zzz
Returning:

Code: Select all

{
"PatNum": 48,
"LName": "Smith",
"FName": "Jane",
...
"DateTStamp": "08/12/2021 15:34:34 -7:00"
}

Please see the section under DateTime Format on our API Implementation page. This will be available in our next beta version, 22.2.14, which is estimated to be released within the next week.

Post Reply