0

Is there any way that i can convert text or number to a date?

for example : 20201104 → 2020/11/04

2
  • Hi, that depends on what you want to do. Do you want to display this text string as a date? Do you need to write it to a data extension time field? Please also share what attempts you have made to solve this yourself. Commented Nov 4, 2020 at 7:52
  • @RafałWolsztyniak thanks for the comment! I would like to display it on the email content. the text value is from data extension field value
    – Z11
    Commented Nov 4, 2020 at 7:56

1 Answer 1

5

In the case of string like 20201104 the DateParse() function will not be able to directly convert this string and use the FormatDate() function.

So your only option is to divide the string into parts using Substring() and stitch them back together using Concat() to recreate the formatting you need.

Steps:

  1. Create variables extracting the 3 date parts you need, for example get the month by using Substring(@yourDateString, 5, 2) (the month starts as the 5th character of your string and you need to extract 2 characters to get the value)
  2. Connect the parts together as you want using the Concat() function like this: Concat(@year, '/', @month, '/', @day)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .