1

I'm trying to construct a date time string using AMPscript in the format yyyy-mmm-ddThh:mm:ss based on the current time (where T is a letter). Is it possible to achieve this without using the Concat() function? Here's what I have at the moment:

Concat(FormatDate(now(), "", "yyyy-MM-ddT"),FormatDate(now(), "", "hh:mm:ss")

2 Answers 2

5

Why not just use the format() function instead of formatDate()?

%%=format(now(),"yyyy-MM-ddThh:mm:ss")=%%

Output

2016-09-29T08:18:51

3

You can pass hh:mm:ss timeformat in FormatDate it self.

%%=FormatDate(now(),"yyyy-MM-ddT","hh:mm:ss")=%%

Output: 2016-09-28T04:02:36

2
  • This does not work for me as I get the output: 2016-09-28T 11:34:21. Note that a space character is inserted after T. Are you sure that you are seeing this exact output? This works for me %%=Replace(FormatDate(now(),"yyyy-MM-ddT","hh:mm:ss"),' ','')=%% but is Replace() really required? Commented Sep 28, 2016 at 17:34
  • 1
    Yeah, im also get the output 2016-09-29T 11:46:21 in landing page and now, Replace function is required to remove the space character. i'm not sure why space character is not coming in ContentBlock.
    – Palash Rai
    Commented Sep 29, 2016 at 6:25

You must log in to answer this question.

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