AMPscript will only do an exact comparison. We can't retrieve today records count from DE.
We need set up a SQL Query to put this into a separate DE. we can do something like just createdadate equal to today , or between two specific times (e.g. 12:00AM and 11:59PM)
First of all welcome.
Everything in your usecase points towards SQL instead of AMPScript.
LookupRows(), and all script based retrievals in SFMC have a row limit of 2000 / 2500 rows respectively. Keep that in mind when deciding what to use.
LookupRows and related functions work with precise matches, there are no ranges or other comparisons (...
I ran a quick test in my environment and by switching this line:
set @rows = LookupRows("TestDE","Createddate",@Today)
set @rows = LookupRows("TestDE","Createddate",@Formatdate)
it returned a course count.
Consider using Apex instead of formula.
Here's why as of January 2021 (SFDC API Version 50.0) . (@ for edits):
Be skeptical of using formula fields for datetime difference calculations
because of a limitation with formula fields, quoted below:
Important: Be aware of timezone conversion issues when using formula
fields to calculate datetime differences:
YYYY is week based calendar.
yyyy is our ordinary calender.
This is not SF behavior. but something expected whenever you use yyyy or YYYY as they are derived from java SimpleDateFormat.
Even SF document points to refer SimpleDateFormat.
Here is an excellent blog post showing this behaviour.
Got the answer
y return year of the era
Y returns week year
so in this last week of Dec when a/few day(s) of the week is/are of next year, YYYY will return 2021 (ie week year) and yyyy (as always) will return current year ie 2020.
In short, if you are looking for the current year always use yyyy and not YYYY else these dec boundary weeks will trouble you; ...