Regardless of the date
field format of the Documents users submit, Veryfi will process it and output the date in YYYY-MM-DD format. If the Documents you submit have different date formats MM/DD/YY, DD/MM/YY, YY/MM/DD, D Month, Yr, DD-MM-YY, etc., based on the context of the OCRed text Veryfi will detect the date format of language/region of the Document and then convert it to YYYY-MM-DD.
🦄 We use the standard ISO date format for JSON ISO 8601
JSON date
field explained here
Please check API schema for date
field limitations and other date-time
fields type.
Please note, that extracted values for date
field follow the ISO standard and not being converted to any particular timezone nor Veryfi returns a timezone in a separate field.
How to get timezone ?
If your use case requires the timezone information for the date
field, Veryfi provides a few fields that should allow you to obtain the timezone based on the vendor’s location.
Those fields are vendor_address
, parse_address
, vendor.lng
& vendor.lat
.
Fields vendor.lng
& vendor.lat
refers to the geographical coordinates (latitude and longitude) associated with a vendor's location. These coordinates provide the precise geographic position of the vendor on the Earth's surface.
parse_address
- is a request parameter that breaks down vendor_address
, bill_to_address
, and ship_to_address
into pieces. Read more
Several online services and libraries can help you with this, such as the APIs provided by Google or OpenStreetMap.
Here's an example using the Google Timezone API (you'll need an API Key for this):
1. Make an API call to the Google Timezone API using the latitude and longitude that Veryfi JSON returns.
The format of the API call would be:
https://maps.googleapis.com/maps/api/timezone/json?location=LATITUDE,LONGITUDE×tamp=CURRENT_TIMESTAMP&key=YOUR_API_KEY
Replace `LATITUDE`, `LONGITUDE`, `CURRENT_TIMESTAMP`, and `YOUR_API_KEY` with the actual values.
2. The API will return a JSON object containing information about the timezone, including the timezone ID and the offset from UTC.
Here's an example using the Python programming language and the `requests`
import requests
import time
def get_timezone(latitude, longitude, api_key):
timestamp = int(time.time())
url = f"https://maps.googleapis.com/maps/api/timezone/json?location={latitude},{longitude}×tamp={timestamp}&key={api_key}"
response = requests.get(url)
data = response.json()
if data['status'] == 'OK':
return data['timeZoneId']
else:
return Noneapi_key = "YOUR_API_KEY"
latitude = 51.5074
longitude = -0.1278
timezone = get_timezone(latitude, longitude, api_key)print("Timezone:", timezone)
Replace `YOUR_API_KEY` with your actual API Key from Google
If you prefer using open-source libraries, you can use the Python package `tzwhere` which uses the timezone data from OpenStreetMap.
To install the package, run:
> pip install tzwhere
Here's an example of how to use it:
from tzwhere import tzwhere
def get_timezone(latitude, longitude):
tz = tzwhere.tzwhere()
timezone = tz.tzNameAt(latitude, longitude)
return timezone
latitude = 51.5074
longitude = -0.1278
timezone = get_timezone(latitude, longitude)print("Timezone:", timezone)
Just replace the `latitude` and `longitude` variables with the respective values from the vendor's address data you have.
Have any questions? Contact us at support@veryfi.com