diff --git a/src/backend/utils/adt/formatting.c b/src/backend/utils/adt/formatting.c
index 233fe2f0f8c3e5d7887a21af19bd7ffb720c3bd2..84e4db8416ab17b65393bcd700c02870ac1a7a91 100644
--- a/src/backend/utils/adt/formatting.c
+++ b/src/backend/utils/adt/formatting.c
@@ -2503,11 +2503,11 @@ DCH_to_char(FormatNode *node, bool is_interval, TmToChar *in, char *out, Oid col
 				break;
 			case DCH_OF:
 				INVALID_FOR_INTERVAL;
-				sprintf(s, "%+0*ld", S_FM(n->suffix) ? 0 : 3, tm->tm_gmtoff / SECS_PER_HOUR);
+				sprintf(s, "%+0*d", S_FM(n->suffix) ? 0 : 3, (int) tm->tm_gmtoff / SECS_PER_HOUR);
 				s += strlen(s);
-				if (tm->tm_gmtoff % SECS_PER_HOUR != 0)
+				if ((int) tm->tm_gmtoff % SECS_PER_HOUR != 0)
 				{
-					sprintf(s, ":%02d", abs(tm->tm_gmtoff % SECS_PER_HOUR) / SECS_PER_MINUTE);
+					sprintf(s, ":%02d", abs((int) tm->tm_gmtoff % SECS_PER_HOUR) / SECS_PER_MINUTE);
 					s += strlen(s);
 				}
 				break;