I have a requirement to output only time from date/time field in a SalesForce campaign for an email I am working on.
I had to split up the date/time in order to format as desired.
SET @Delivery = [Customer_Delivery__c] SET @DeliveryDay = FormatDate(@Delivery, "ddddd, MMMM d, yyyy", "", "en-US") SET @DeliveryTime = FormatDate(@Delivery, "", "H:mm tt", "en-US")
Here is my output code:
%%=v(@DeliveryDay)=%% %%=DateAdd(@DeliveryTime, "-4","H")=%%
I should mention that I had an additional requirement to subtract 4 hours from the delivery time.
I did so by using the DateAdd function to subtract 4 hours. - Now the problem is that when I use DateAdd the output after running the code is:
Monday, October 1, 2018 10/1/2018 2:30:00 PM
I want to remove the 10/1/2018 line. - How can I exclude the duplicate output of the date?
Desired output should be:
Monday, October 1, 2018 2:30:00 PM
When I don't use DateAdd it does not give me duplicate date but I have to use DateAdd to display the correct time.
All help here would be greatly appreciated!