Summary
DateAdd()
DateDiff()
DateParse()
DatePart()
FormatDate()
GetSendTime()
LocalDateToSystemDate()
Now()
StringToDate()
SystemDateToLocalDate()
DID THIS ARTICLE SOLVE YOUR ISSUE?
Let us know so we can improve!
Let us know so we can improve!
Extracts a date part (such as the day, month, or year) from a date or timestamp string.
| Marketing Cloud Engagement | ✅ Yes |
| Marketing Cloud Next | ❌ No |
1DatePart(dateString, datePart)The DatePart() function has two parameters:
dateString (string): Required. A string that contains a date or timestamp.datePart (string): Required. The date part that you want to extract from the string. Accepted values: Y (years), M (months), D (days), H (hours), and MI (minutes).You can specify a date string in several formats, including:
2023-08-05T13:41:23-06:002023-08-058/5/2023 1:41 PM5 August 2023 or August 5, 20232023-08-05 1:41:23 PM1:41 PM2023 年 8 月 5 日2023년 8월 5일The function doesn’t support these formats:
August 5th, 2023 or 5th August 2023.5/8/2023 to represent the 5th of August, 2023.5 août 2023.٢٠٢٣/٨/٥.18 Av, 5783 or 18 Muharram, 1445.This example extracts the year from a date string.
1%%[
2 Var @date, @year
3 Set @date = "2023 年 8 月 5 日"
4 Set @year = DatePart(@date, "Y")
5]%%
6<p>The current year is %%=v(@year)=%%.</p>The example outputs the current year:
1The current year is 2023.