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 = 12/30/2024 4:47:57 PM
1. var_today is an integer used to compare current date to CRM dates (without the time component) in Liquid script
var_todayAEST = 12/31/2024 2:47:57 AM
var_today = 20241230
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-12-31
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"'