How to write an expression to use in email to check a field date equals today | Community
Skip to main content
December 18, 2024
Solved

How to write an expression to use in email to check a field date equals today

  • December 18, 2024
  • 2 replies
  • 700 views

Hi there,

 

May I ask how can I write an expression to check a condition in my email - to check if product > field date value = today? I tried the below and didn't seem to work. My product date field format is "2024-12-19".

 

{%#if productDate = currentTimeInMillis() %}

 

Thanks,

Amanda

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Mohan_Dugganab

You can validate it on the following lines 

{%let a = now %} {%let b = toDateTimeOnly("2024-12-19T09:57:27.980Z") %} {%let c = dateDiff(b,a) %} {%#if c =0 %} // If the difference is zero, product field date is today render_1 {%else%} default_render {%/if%}

2 replies

December 19, 2024

May need to try something like this  {%#if toDateTimeOnly(currentTimeInMillis()) == toDateTimeOnly(productDate) %}

Mohan_Dugganab
Adobe Employee
Mohan_DugganabAdobe EmployeeAccepted solution
Adobe Employee
December 21, 2024

You can validate it on the following lines 

{%let a = now %} {%let b = toDateTimeOnly("2024-12-19T09:57:27.980Z") %} {%let c = dateDiff(b,a) %} {%#if c =0 %} // If the difference is zero, product field date is today render_1 {%else%} default_render {%/if%}
AmandaKo4Author
January 9, 2025

Hey @mohan_dugganab, do you know how i can convert the now (which is in UTC time) to local Sydney time (noting Australia has a few time zones based on states so this got to be Sydney). Thanks!