I have a variable that that is pulling from another variable and applying the Field function to it as below.

set @CampaignStartTime = Field(@CampTypeRows,"Event_Time_Text__c")

I now want to apply the function SystemDateToLocalDate to the line above to make the time output localised.

I tried the below but keep getting validation issues:

set @CampaignStartTime = SystemDateToLocalDate(Field(@CampTypeRows,"Event_Time_Text__c"))

Also, worth mentioning I have another block further down the email which is setting new variables using @CampaignStartTime. Will any changes impact my second block?

   set @GoogleStartEndTime = (CONCAT(
   Format(@CampaignDate, "yyyyMMdd")),
   Format(@CampaignStartTime, "HHmm"),
   Format(@CampaignDate, "yyyyMMdd"),
   Format(@CampaignEndTime, "HHmm"),

What am I doing wrong? and How can I fix it?

  • I would also make sure 'Event_Time_Text__c' is actually a date field. The name implies it's a text version of a date which isn't compatible with date functions. Commented Mar 18, 2020 at 14:01

1 Answer 1


I suspect, not having your complete Ampscript, the issue is caused by you not selecting a single row, but applying Field function to multiple rows. Here is what you need to do:

SET @rowCount = rowcount(@CampTypeRows) /* count rows to ensure your lookup returns something */

IF @rowCount > 0 THEN /* only execute this block if you have some results */

  SET @row = row(@CampTypeRows,1) /* get row #1 */
  SET @CampaignStartTime = SystemDateToLocalDate(Field(@row,"Event_Time_Text__c")) /* Convert your date */


Your AmpScript further down the page will work without issues.

  • @MJB - remember to mark the answer as accepted Commented Mar 23, 2020 at 10:22

You must log in to answer this question.

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