<@U04SE163WC8> If I use `{{ now_utc().strftime('%s...
# ask-ai
a
@kapa.ai If I use
{{ now_utc().strftime('%s') }}
in the API call I obtain the time for now in utc, that's ok, can I use a formula to reduce the time 1 or 2 months?
k
Yes, you can use the
day_delta
macro to adjust the current time by a specific number of days. To reduce the time by 1 or 2 months, you can calculate the approximate number of days in those months and use the
day_delta
macro accordingly. For example, to reduce the time by 1 month (approximately 30 days) or 2 months (approximately 60 days), you can use the following formulas: ### Reduce by 1 Month
Copy code
jinja '{{ day_delta(-30, format='%Y-%m-%dT%H:%M:%S') }}'
### Reduce by 2 Months
Copy code
jinja '{{ day_delta(-60, format='%Y-%m-%dT%H:%M:%S') }}'
Here is an example of how you can use it in your API call:
Copy code
jinja '{{ day_delta(-30, format='%s') }}'
This will give you the timestamp for 30 days (approximately 1 month) before the current time in UTC. For more details on the
day_delta
macro, you can refer to the [Airbyte documentation](https://docs.airbyte.com/connector-development/config-based/understanding-the-yaml-file/reference#/macros/Day%20Delta). If you need further customization or have more specific requirements, please let me know!
a
@kapa.ai that day_delta can use month delta or year delta?
k
A message from kapa.ai
The
day_delta
macro in Airbyte is designed to work with days and does not directly support month or year deltas. However, you can approximate month or year deltas by calculating the number of days in those periods. For example: - 1 month can be approximated as 30 days. - 1 year can be approximated as 365 days. Here are examples of how you can use
day_delta
to approximate month and year deltas: ### Reduce by 1 Month (Approx. 30 Days)
Copy code
jinja '{{ day_delta(-30, format='%Y-%m-%dT%H:%M:%S') }}'
### Reduce by 1 Year (Approx. 365 Days)
Copy code
jinja '{{ day_delta(-365, format='%Y-%m-%dT%H:%M:%S') }}'
For more details on the
day_delta
macro, you can refer to the [Airbyte documentation](https://docs.airbyte.com/connector-development/config-based/understanding-the-yaml-file/reference#/macros/Day%20Delta). If you need more precise control over month or year calculations, you might need to handle this logic outside of the
day_delta
macro, possibly using a more advanced scripting or programming approach.