2

I'd like to re-format a phone number in AMPscript from 1234567890 to (123) 456-7890 or 123-456-7890. I've tried using the Format function

%%=Format(%%CLIENT_PHONE%%,"(###) ###-####")=%% 

where CLIENT_PHONE evaluates to 1234567890.

Can someone help?

2 Answers 2

5

Answering my own question here - sorry for that - looks like I added too many % signs.

%%=Format(CLIENT_PHONE,"(###) ###-####")=%%

That corrected the issue, and it now works perfectly. Thanks all!

1
  • Hi Kelly, thanks for posting the answer. This helped me out! Commented Oct 5, 2015 at 17:29
0

I don't have experience with AMPscript, but looking at the documentation, it appears that it uses C# syntax. Try

%%=Format("{0:(###) ###-####}", %%CLIENT_PHONE%%)=%% 
1
  • Thank you - it turns out the syntax I had was correct, but I added too many percent signs. %%=Format(CLIENT_PHONE,"(###) ###-####")=%% would do the trick. Commented Dec 12, 2013 at 14:38

You must log in to answer this question.

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