We do our best to ensure that the code in these articles works as advertised, but please be aware that Zapier Support does not officially help with code steps due to their advanced nature. Feel free to comment on the article or ask in the Zapier Community, where we have code-savvy users.
About
Used to create conditional logic that is evaluated based on inputs.
How to Configure
Copy the Code
let Hour = inputData.Hour; // 0-23 for a 24 hour clock; 0 = 12 AM, 12 = 12 PM
let AMPM = ""; // sets a blank value
if (Hour < 12) {
AMPM = "AM"; // sets AM if value is less than 12
}
else {
AMPM = "PM"; // sets PM if NOT AM (aka a value equal to or greater than 12)
}
output = t{Hour, AMPM}];
The Results
Contribution by Troy Tessalone
Troy is a Certified Zapier Expert who automates workflows with no-code and low-code apps to help clients save time and make money.