Background: On a cloud page in SFMC, I am trying to display a message if today's date is between start and end dates that are coming from data extension.
Question: How can I perform a check and see if today's date is between start and end dates?
Issue: Nothing is currently displaying on the cloud page.
Here is what I got so far on a cloud page:
<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
%%[
set @date = Now()
set @searchterm = "true" /* value from attribute or DE column in send context */
set @getStart = Lookup("Test_DE_Dates", "Start_Date", "ROW_ADDED", @searchterm)
set @getEnd = Lookup("Test_DE_Dates", "End_Date", "ROW_ADDED", @searchterm)
IF @date >= @getStart AND @date <= @getEnd THEN
set @output= 'true'
]%%
<div class="sectionForm">
<div class="columns col1">
<div data-type="slot" data-key="col1"></div>
</div>
</div>
%%[ ELSE ]%%
%%[ set @output = 'false' ]%%
<p>This page has been expired</p>
%%[ ENDIF ]%%
</body>
</html>
]%%
) after the@getStart
variable is set. Try removing that first.false
for@output
? If you inspect the page's generated HTML from your browser (via dev tools), is it empty? Try a pure AMPscript implementation first (without the HTML) and make sure the values for@getStart
and@getEnd
are what you expect them to be.