You’re offline. This is a read only version of the page.
Date support functions for consistent date handling in Liquid script & fetch
Create 2 variables: 1. var_today for Liquid scripts 2. var_today_fetch for fetch (data) operations
Limitations using var_today:
a. Now function returns UTC with date AND time.
b. Now function is not always accurate as the value is cached (??).
Now = 10/8/2024 5:14:05 AM
1. var_today is an integer used to compare current date to CRM dates (without the time component) in Liquid script
var_todayAEST = 10/8/2024 3:14:05 PM
var_today = 20241007
Example test run on 13/10/21 10 AM (in AEST)
Liquid now returns 12/10/21 11 PM
CRM sample record has display date=13/10/21; when retrieved in Liquid (in UTC) it returns 12/10/21 1 PM
In Liquid script: Convert CRM date using '| date: "yyyyMMdd" | integer' returns '20211012'
To compare to current date as integer var_today needs to have value '20211012' (prior day taking into account time-zone differences)
2. var_today_fetch is date in format yyyy-MM-dd used for fetch XML run directly on database
Fetch resolves date's time component
var_today_fetch = 2024-10-08
Example test run on 13/10/21 10 AM (in AEST)
CRM sample record has display date=13/10/21; when retrieved in Liquid (in UTC) it returns 12/10/21 1 PM
In Fetch to test current date need to set 'value="2021-10-13"'