I have an attribute named ClassStartDateTime in a data extension with a value of:

Wednesday, April 19, 2017 9:00 AM

I'd like to extract only the time from this attribute using the FormatDate() function.

SET @class_starttime = FormatDate(ClassStartDateTime, 'h:mm tt')

Any idea why the month is being pulled in instead of the minute? The output looks like this:

9:04 AM


Answered after a support ticket...

The FormatDate() function will always be looking for a Month/year and minute. So in order to exclude one or more of the parts, you need to include a empty set of ''

So the formatting will look like this:

Set @class_start_time = FormatDate(ClassStartTime,'','h:mm tt')

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.