DateParse Function

The DateParse function returns the date/time with the option of displaying in UTC format. A good use case is to use DateParse to convert the time to UTC format. Not to be confused with the DatePart function.

Syntax:



DateParse(1,2)
1 = Date string to evaluate (can be a variable). Valid values include ‘MM/dd/yyyy’ or ‘YYYY-MM-DD’
2 = True or False value where a true value returns the value in UTC format

Example:



%%[
var @date, @result
set @date = Now()
set @result = DateParse(@date,1)


]%%
Output: %%=v(@result)=%%

Output:

Output: 2/15/2021 6:20:21 AM

Explanation:

Using the DateParse function, the AMPscript above is taking today’s date and time and returning the date/time value to UTC format. This can be used in conjunction with the DateAdd function or the DateDiff function.

Leave a Reply

Your email address will not be published. Required fields are marked *