Quantcast
Channel: Active questions tagged ampscript - Salesforce Stack Exchange
Viewing all articles
Browse latest Browse all 359

Day light saving in SMS using ampscript

$
0
0

We have written code Ampscript code to cover the day light savings for this year, but we need to update this code to work fork every year based on the day light saving dates(As day light saving dates changes every year)

Here is my ampscript code:

%%[/* Get current year */SET @ExistcurrentYear = DatePart(@Existing_Visit_Date, "year")/* Start and End of Daylight Saving Time (DST) for ExistVisitDate */SET @ExistdstStart = DateParse(CONCAT(@ExistcurrentYear, "-03-10"))  /* 2nd Sunday in March */SET @ExistdstEnd = DateParse(CONCAT(@ExistcurrentYear, "-11-03"))  /* 1st Sunday in November *//* Check if the current date is within the DST range */ IF @Existing_Visit_Date >= @ExistdstStart AND @Existing_Visit_Date < @ExistdstEnd THEN SET @ExistisDST = 'TRUE'ELSE SET @ExistisDST ='FALSE'ENDIF/* Adjust the date if DST is in effect */IF @ExistisDST  == 'FALSE'THENSET @ExistadjustedDate = DateAdd(@Existing_Visit_Date, -1, "H") /* Add 1 hour for DST */   ELSE    SET @ExistadjustedDate = @Existing_Visit_DateENDIF]%%

Viewing all articles
Browse latest Browse all 359

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>