Skip to main content
Dec 18, 2024 6:33 AM UTC
Solved

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

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.
Mohan_Dugganab
Mohan_DugganabAccepted solution
Adobe Employee
Dec 21, 2024 4:40 PM UTC

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%}

3 replies

Dec 19, 2024 11:59 PM UTC

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

Translate
Mohan_Dugganab
Adobe Employee
Mohan_DugganabAdobe EmployeeAccepted solution
Adobe Employee
Dec 21, 2024 4:40 PM UTC

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%}
Translate
AmandaKo4Author
Jan 9, 2025 1:19 AM UTC

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!

Translate