My input start date in in the format: %Y-%m-%dT%H:...
# ask-ai
m
My input start date in in the format: %Y-%m-%dT%H:%M:%SZ. Although my api request requires %Y-%m-%d. Using low code how can I set this parameter for start date and end date
u
To handle the date format conversion in a low-code Airbyte connector, you can use the
format_datetime
macro in your YAML configuration. This macro allows you to convert a datetime string from one format to another. Here's how you can set it up: 1. For the start date:
Copy code
yaml start_datetime:   datetime: "{{ config['start_date'] }}"   datetime_format: "%Y-%m-%dT%H:%M:%SZ"
2. Then, when you need to use this date in the API request, you can format it like this:
Copy code
yaml start_time_option:   field_name: "from-date"   inject_into: "request_parameter"   format: "{{ format_datetime(stream_state['start_datetime'], '%Y-%m-%d') }}"
3. Similarly for the end date (assuming you're using the current date):
Copy code
yaml end_time_option:   field_name: "to-date"   inject_into: "request_parameter"   format: "{{ format_datetime(now_utc(), '%Y-%m-%d') }}"
This approach uses the
format_datetime
macro to convert the datetime from the ISO 8601 format (%Y-%m-%dT%H:%M:%SZ) to the format required by your API (%Y-%m-%d). You can find more information about the
format_datetime
macro in the [Airbyte documentation on interpolation macros](https://docs.airbyte.com/connector-development/config-based/understanding-the-yaml-file/reference#/macros/Format%20Datetime). Remember to adjust the field names and injection method according to your specific API requirements. [Airbyte Documentation: Format Datetime](https://docs.airbyte.com/connector-development/config-based/understanding-the-yaml-file/reference#/macros/Format%20Datetime)
m
@kapa.ai No format in ['%Y-%m-%d'] matching 2024-10-20T000000.000Z
u
This error message suggests there's a mismatch between the expected date format and the actual date format being used in an Airbyte connector. The error indicates that the system is expecting a date in the format '%Y-%m-%d' (year-month-day), but it's receiving a date in the format '2024-10-20T000000.000Z', which includes time and timezone information. This issue is similar to problems reported in several Airbyte connectors. Here are a few potential solutions: 1. Update the date format: If you have control over the connector configuration, you might need to update the expected date format to match the incoming data. The format should be '%Y-%m-%dT%H:%M:%S.%fZ' to match the ISO 8601 format you're receiving. 2. Check the connector version: Some connectors have had similar issues fixed in newer versions. For example, the Braintree connector had a similar problem that was resolved in version 0.3.1 [GitHub Issue #31061](https://github.com/airbytehq/airbyte/issues/31061). 3. Verify the date field configuration: Ensure that the date field in your connector configuration is set correctly. Some connectors require specific date formats for fields like "start date" [GitHub Issue #31061](https://github.com/airbytehq/airbyte/issues/31061). 4. Review the connector's manifest.yaml: If you're a developer working on the connector, you might need to update the
datetime_format
in the manifest.yaml file to accommodate the ISO 8601 format [GitHub Issue #41054](https://github.com/airbytehq/airbyte/issues/41054). If these solutions don't resolve your issue, you may need to provide more context about the specific connector you're using and its configuration. Consider opening an issue on the Airbyte GitHub repository with detailed information about your setup and the full error message.