2

The Problem

A wrong date gets calculated by AMPScript GetSendDate with SystemDateToLocalDate inside a journey that is triggered by automations. Our SendLog DataExtensions has senddates displayed in Central Standard Time [Marketing Cloud Default]. The Business Unit (which is the Parent Business Unit) has a TimeZone set to (GMT+01:00) Amsterdam, Berlin, Bern, Rome, Stockholm, Vienna *

The AmpScript

We have a journey that gets activated when an SQL activity finishes. Inside the first newsletter we display a day that is 7 days ahead of time. The script responsible for this can be found below:

%%[
set @seven_days_ahead_date = SystemDateToLocalDate(DateAdd(GetSendTime(1),'7','D')) 
set @output_date = FormatDate(@seven_days_ahead_date,"d. MMMM YYYY",, "de_DE")
]%%

%%=v(@output_date)=%%

The Outputs

21st April

On the 21st April, around 4PM - Central European Summer Time, the journey got triggered.

The SendLog Timestamp shows this date: 4/21/2020 7:32:49 AM [Central Standard Time]

The email/ampscript has successfully calculated a Date of 28. April 2020 in this send process.

22nd April

On the 22nd April, closely after 8AM - Central European Summer Time, the journey got triggered a second time. This trigger has been activated after 8AM, knowing that the day changes in the Central Standard Time when it is 8AM in Europe (our location). Central European Standard Time is 8 hours ahead of Central Standard Time right now.

The SendLog shows a SendDate of 4/22/2020 12:02:49 AM [CentralStandard Time]

The email/ampscript has calculated a Date of 28. April 2020 in this send process, which is wrong and very irritating to me because of many different reasons. The Journey still has the same version as the first one that was send on the 21st of April.

My thoughts to this problem

Faith in myself

  • Even without a SystemDateToLocalDate the Date should have been the 22nd April in the second email.
  • There should be no problem with a change of the day, because both timezones have the same day.
  • GetSendTime should be configured correctly, using the true / "1" value to get the sendtime per subscriber when the send finished.

Doubts

  • The Documentation of GetSendTime of ampscript.guide, shows a note, that makes me doubt that there is another interaction with the deployment of the journey

NOTE: For a Triggered Send (or Journey email) no value or false returns the time the Triggered Send Definition was last published.

  • The SendProcess took place to close to the change of day in america, which could potentially result in CST having 21nd April instead of 22nd April [but this shouldn't have an influence here, i strongly believe]

I queried the _Job Dataview for this send and took the Dates which are available in _Job. The result can be found below.

Dates received from _Job

Ressources

2
  • 1
    On the SF Doc page there is a table with Now vs GetSendTime explaining the meaning of the returned values: developer.salesforce.com/docs/… Using the "1" parameter makes the function look for the Job publish time, not start. Maybe you can look into that some more? Not sure if that is the problem tho.
    – DonL
    Commented Apr 22, 2020 at 8:11
  • Ok then AMPScript Guide and Salesforce Documentation tell contradictory facts. AMPScript Guide says: A value of true returns the date and time the send completed for a subscriber; Salesforce Documentation says: GetSendTime(1) - Job publish time. Commented Apr 22, 2020 at 8:41

2 Answers 2

2

Just to be clear, I did actually test the getSendTime function in the three contexts before adding the function to The AMPscript Guide.

  • Normal UI-Send
  • Triggered Send
  • Journey Send

I added what I thought was correct.

Sidebar: Contractdicting the official documentation in The AMPscript Guide was not unprecedented. It was (at least for me) one of the primary drivers to doing the work to provide an alternative source of documentation that's actually been scrutinized and tested.

I ran the following code through all three contexts again, and it appears to be behaving differently:

%%[

var @sendTimeNoArg, @sendTimeFalseArg, @sendTimeTrueArg

set @sendTimeNoArg  = GetSendTime()
set @sendTimeNoArg =  format(@sendTimeNoArg,"yyyyMMddhhmmss")

set @sendTimeFalseArg  = GetSendTime(0)
set @sendTimeFalseArg =  format(@sendTimeFalseArg,"yyyyMMddhhmmss")

set @sendTimeTrueArg  = GetSendTime(1)
set @sendTimeTrueArg =  format(@sendTimeTrueArg,"yyyyMMddhhmmss")

]%%
sendTimeNoArg: %%=v(@sendTimeNoArg)=%%
<br>sendTimeFalseArg: %%=v(@sendTimeFalseArg)=%%
<br>sendTimeTrueArg: %%=v(@sendTimeTrueArg)=%%

In all three instances, it returned the exact same value, regardless of the argument:

UI Send

sendTimeNoArg: 20200422061443
sendTimeFalseArg: 20200422061443
sendTimeTrueArg: 20200422061443

Journey

sendTimeNoArg: 20200422062744
sendTimeFalseArg: 20200422062744
sendTimeTrueArg: 20200422062744

Trigger

sendTimeNoArg: 20200422065041 
sendTimeFalseArg: 20200422065041 
sendTimeTrueArg: 20200422065041 

Timezone settings for my user:

(GMT-06:00) Central Time (No Daylight Savings)

If anyone would like to take this through Salesforce Support, I'd be glad to make the necessary revisions on The AMPscript Guide.

7
  • If there in fact was a change to the behaviour of the function, it makes me question why there is no "technical changes"-release notes or something.
    – DonL
    Commented Apr 22, 2020 at 15:01
  • 1
    Not only that but it confusingly overlaps with the Now() function. Commented Apr 22, 2020 at 18:28
  • 1
    Until now i have the same findings as you adam, support took over, the first answer they gave is: Unfortunately it is taking a bit longer than expected, I kindly request your patience on it Commented Apr 23, 2020 at 6:19
  • Good to know the current status of those functions. Lets see.
    – DonL
    Commented Apr 23, 2020 at 6:32
  • 1
    For anyone that runs into this and maybe also for ampscript.guide. When you use GetSendTime(1) in combination of a journey the GetSendTime(1) will always reference the point when the journey was activated (not TRIGGERED). So if you activate a journey on the 24th of december 2019 GetSendTime(1) will always reference this date and not any future trigger times of the journey (for example if it triggered each month getsendtime(1) will still have the 24th of 2019 all the time. Commented May 14, 2020 at 6:40
1

SFMC Support Answer

(for a Journey Builder Triggered Send);

During Send time

GetSendTime() = Current system time

GetSendTime(1) = Current system time

After a Send (VAWP)

GetSendTime() = Individual subscriber send completed time

GetSendTime(1) = Job publish time

For anyone that runs into this and maybe also for ampscript.guide. When you use GetSendTime(1) in combination of a journey the GetSendTime(1) will always reference the point when the journey was activated (not TRIGGERED). So if you activate a journey on the 24th of december 2019 GetSendTime(1) will always reference this date and not any future trigger times of the journey (for example if it triggered each month getsendtime(1) will still have the 24th of 2019 all the time.




This is no final answer but i wanted to shorten the question and this stuff is more like an answer.

Findings until now

AMPScript Guide documentation on GetSendDate has to be wrong:

A value of true returns the date and time the send completed for a subscriber. A value of false returns the date and time the send started. The default value is false if no value is specified NOTE: For a Triggered Send (or Journey email) no value or false returns the time the Triggered Send Definition was last published.

The value GetSendTime(1) delivers (for the send process on the 22nd) has to be before 21st 4PM, because of the interaction with SystemDateToLocalDate that adds another 8hours because of the timezone difference. This makes me seriously doubt GetSendTime(1), because salesforce and ampscript guide tell different things.

Narrowing down further

To narrow down further i created a journey that is going to send every hour. The journey includes one email that inherits Adam's AMPScript. To test every function i used i duplicated the script into four different versions.

Blocks

1

%%[

var @sendTimeNoArg, @sendTimeFalseArg, @sendTimeTrueArg
var @NowNoArg, @NowFalseArg, @NowTrueArg

set @sendTimeNoArg  = GetSendTime()
set @sendTimeNoArg =  format(@sendTimeNoArg,"yyyyMMddhhmmss")

set @sendTimeFalseArg  = GetSendTime(0)
set @sendTimeFalseArg =  format(@sendTimeFalseArg,"yyyyMMddhhmmss")

set @sendTimeTrueArg  = GetSendTime(1)
set @sendTimeTrueArg =  format(@sendTimeTrueArg,"yyyyMMddhhmmss")

set @NowNoArg  = Now()
set @NowNoArg =  format(@NowNoArg,"yyyyMMddhhmmss")

set @NowFalseArg  = Now(0)
set @NowFalseArg =  format(@NowFalseArg,"yyyyMMddhhmmss")

set @NowTrueArg  = Now(1)
set @NowTrueArg =  format(@NowTrueArg,"yyyyMMddhhmmss")

]%%


sendTimeNoArg: %%=v(@sendTimeNoArg)=%%
<br>sendTimeFalseArg: %%=v(@sendTimeFalseArg)=%%
<br>sendTimeTrueArg: %%=v(@sendTimeTrueArg)=%%
<br><br>

NowNoArg: %%=v(@NowNoArg)=%%
<br>NowFalseArg: %%=v(@NowFalseArg)=%%
<br>NowTrueArg: %%=v(@NowTrueArg)=%%

<br><br><br>

2 (added SystemDateToLocaleDate)

%%[

var @Transformed_sendTimeNoArg, @Transformed_sendTimeFalseArg, @Transformed_sendTimeTrueArg
var @Transformed_NowNoArg, @Transformed_NowFalseArg, @Transformed_NowTrueArg

set @Transformed_sendTimeNoArg = SystemDateToLocalDate(GetSendTime())
set @Transformed_sendTimeNoArg = format(@Transformed_sendTimeNoArg,"yyyyMMddhhmmss")

set @Transformed_sendTimeFalseArg = SystemDateToLocalDate(GetSendTime(0))
set @Transformed_sendTimeFalseArg = format(@Transformed_sendTimeFalseArg,"yyyyMMddhhmmss")

set @Transformed_sendTimeTrueArg = SystemDateToLocalDate(GetSendTime(1))
set @Transformed_sendTimeTrueArg = format(@Transformed_sendTimeTrueArg,"yyyyMMddhhmmss")

set @Transformed_NowNoArg = SystemDateToLocalDate(Now())
set @Transformed_NowNoArg = format(@Transformed_NowNoArg,"yyyyMMddhhmmss")

set @Transformed_NowTimeFalseArg = SystemDateToLocalDate(Now(0))
set @Transformed_NowTimeFalseArg = format(@Transformed_NowTimeFalseArg,"yyyyMMddhhmmss")

set @Transformed_NowTimeTrueArg = SystemDateToLocalDate(Now(1))
set @Transformed_NowTimeTrueArg = format(@Transformed_NowTimeTrueArg,"yyyyMMddhhmmss")


]%%

Transformed_sendTimeNoArg: %%=v(@Transformed_sendTimeNoArg)=%%
<br>Transformed_sendTimeFalseArg: %%=v(@Transformed_sendTimeFalseArg)=%%
<br>Transformed_sendTimeTrueArg: %%=v(@Transformed_sendTimeTrueArg)=%%
<br><br>

Transformed_NowNoArg: %%=v(@Transformed_NowNoArg)=%%
<br>Transformed_NowTimeFalseArg: %%=v(@Transformed_NowTimeFalseArg)=%%
<br>Transformed_NowTimeTrueArg: %%=v(@Transformed_NowTimeTrueArg)=%%

<br><br><br>

3 (added the addition part)

%%[

var @Transformed_sendTimeNoArg, @Transformed_sendTimeFalseArg, @Transformed_sendTimeTrueArg
var @Transformed_NowNoArg, @Transformed_NowFalseArg, @Transformed_NowTrueArg

set @Transformed_sendTimeNoArg = SystemDateToLocalDate(GetSendTime())
set @Transformed_sendTimeNoArg = format(@Transformed_sendTimeNoArg,"yyyyMMddhhmmss")

set @Transformed_sendTimeFalseArg = SystemDateToLocalDate(GetSendTime(0))
set @Transformed_sendTimeFalseArg = format(@Transformed_sendTimeFalseArg,"yyyyMMddhhmmss")

set @Transformed_sendTimeTrueArg = SystemDateToLocalDate(GetSendTime(1))
set @Transformed_sendTimeTrueArg = format(@Transformed_sendTimeTrueArg,"yyyyMMddhhmmss")

set @Transformed_NowNoArg = SystemDateToLocalDate(Now())
set @Transformed_NowNoArg = format(@Transformed_NowNoArg,"yyyyMMddhhmmss")

set @Transformed_NowTimeFalseArg = SystemDateToLocalDate(Now(0))
set @Transformed_NowTimeFalseArg = format(@Transformed_NowTimeFalseArg,"yyyyMMddhhmmss")

set @Transformed_NowTimeTrueArg = SystemDateToLocalDate(Now(1))
set @Transformed_NowTimeTrueArg = format(@Transformed_NowTimeTrueArg,"yyyyMMddhhmmss")


]%%

Transformed_sendTimeNoArg: %%=v(@Transformed_sendTimeNoArg)=%%
<br>Transformed_sendTimeFalseArg: %%=v(@Transformed_sendTimeFalseArg)=%%
<br>Transformed_sendTimeTrueArg: %%=v(@Transformed_sendTimeTrueArg)=%%
<br><br>

Transformed_NowNoArg: %%=v(@Transformed_NowNoArg)=%%
<br>Transformed_NowTimeFalseArg: %%=v(@Transformed_NowTimeFalseArg)=%%
<br>Transformed_NowTimeTrueArg: %%=v(@Transformed_NowTimeTrueArg)=%%

<br><br><br>

4 (added FormatDate with locale)

%%[

var @German_sendTimeNoArg, @German_sendTimeFalseArg, @German_sendTimeTrueArg
var @German_NowNoArg, @German_NowFalseArg, @German_NowTrueArg

set @German_sendTimeNoArg = SystemDateToLocalDate(DateAdd(GetSendTime(),'7','D'))
set @German_sendTimeNoArg = FormatDate(@German_sendTimeNoArg,"d. MMMM YYYY",, "de_DE")

set @German_sendTimeFalseArg = SystemDateToLocalDate(DateAdd(GetSendTime(0),'7','D'))
set @German_sendTimeFalseArg =FormatDate(@German_sendTimeFalseArg,"d. MMMM YYYY",, "de_DE")

set @German_sendTimeTrueArg = SystemDateToLocalDate(DateAdd(GetSendTime(1),'7','D'))
set @German_sendTimeTrueArg = FormatDate(@German_sendTimeTrueArg,"d. MMMM YYYY",, "de_DE")

set @German_NowNoArg = SystemDateToLocalDate(DateAdd(Now(),'7','D'))
set @German_NowNoArg = FormatDate(@German_NowNoArg,"d. MMMM YYYY",, "de_DE")

set @German_NowTimeFalseArg = SystemDateToLocalDate(DateAdd(Now(0),'7','D'))
set @German_NowTimeFalseArg = FormatDate(@German_NowTimeFalseArg,"d. MMMM YYYY",, "de_DE")

set @German_NowTimeTrueArg = SystemDateToLocalDate(DateAdd(Now(1),'7','D'))
set @German_NowTimeTrueArg = FormatDate(@German_NowTimeTrueArg,"d. MMMM YYYY",, "de_DE")


]%%

German_sendTimeNoArg: %%=v(@German_sendTimeNoArg)=%%
<br>German_sendTimeFalseArg: %%=v(@German_sendTimeFalseArg)=%%
<br>German_sendTimeTrueArg: %%=v(@German_sendTimeTrueArg)=%%
<br><br>

German_NowNoArg: %%=v(@German_NowNoArg)=%%
<br>German_NowTimeFalseArg: %%=v(@German_NowTimeFalseArg)=%%
<br>German_NowTimeTrueArg: %%=v(@German_NowTimeTrueArg)=%%

Email Preview

enter image description here

Dates are correct.

Email send

Dates are correct and show the same value

JourneySend on 22nd 11:03PM (CEST) - 22nd 3:03PM (CST)

Dates are correct and show the same value

When entering the View as WebPage on the 23rd around 8:40AM (CEST) it shows the image below

enter image description here

JourneySend on 23rd 8:06AM (CEST) - 23rd 12:06 AM (CST)

Dates are correct and show the same value

When entering the View as WebPage on the 23rd around 8:40AM (CEST) it shows the image below

enter image description here

Creating a new Journey that is triggered by SQL automation

... to be continued ...

Ressources

You must log in to answer this question.

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