The scenario is:

An email is sent out which does a lookup on a DE and grabs the daily news. I have used a JSON feed in the DE and GTL to extract the news to an email. Since the news is logged into a DE using SSJS which runs as a script in an automation everyday, I have setup a DE field(ID) of "NEWS_(Today-Date)" as a lookup from an email.

When SSJS script stores news into DE everyday with a date ID, it uses the current date. I have used AMPScript to match with the date ID in DE. The issue is when I view the email as a webpage or VWAP a day later - the Now() Amscpript reruns and uses the current date while it is supposed to be the date when an email sent out.

For the solution I tried using the %%xtlongdate%% or %%xtshortdate%%to get the date of the email send so it matches back to the news of that day from DE in the web version. It seems like SystemDateToLocalDate(xtshortdate) doesn't work as expected.

Does anyone have any scenarios like this or solutions to my problem?

Could anyone explain how exactly %%xtshortdate%% works?

Also, the personalization string reference is from here.

Here is a piece of code for reference:

    IF _messageContext != "VAWP" THEN 
        SET @today = Format(SystemDateToLocalDate(Now()), "yyyyMMdd")

    IF _messageContext == "VAWP" THEN 
        SET @today = Format(SystemDateToLocalDate(xtlongdate), "yyyyMMdd")

    SET @NewsContentRS = LookupRows("LookupDE","ID",Concat("NEWS_",@today))
  • What value does "Now(true)" get you? Same as "xtlongdate"?
    – Macca
    Aug 9, 2017 at 1:24
  • @Macca the issue is if a user opens an email which was sent 3 days ago, the web version will execute the today's date and lookup will retrieve the today's news which won't match with the news in the email. So what exactly does "Now(true)" get ? Aug 9, 2017 at 1:41
  • 3
    Yes. I understand your question. "Now(true)" should return time of send, also.
    – Macca
    Aug 9, 2017 at 2:40
  • @Macca Would you like to answer here. I am happy to accept and upvote your answer :) Aug 9, 2017 at 3:49

1 Answer 1


The "xtlongdate" personalization string should, in theory return you the original time of the send, rather than the point in time the View as Web Page is rendered. That's indeed what the documentation suggests should be the behaviour.

As an alternative, you can use the Now() AMPScript function (or the equivalent Now() SSJS function) to get the time of the original send by passing the optional "returnTimeOfSend" parameter:


    SET @timeOfSend = Now(true)


<script runat="server">
    Platform.Load("core", "1");

    var timeOfSend = Now(1);

You must log in to answer this question.

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