I found out that the time zone settings (e.g for due date) in ServiceNow API call is a bit tricky when trying to automate the change request creation in ServicerNow. Here is the rule that I figured out:
If the account that is used for making the API request has time zone settings, then the datetime related input will use the same timezone. Otherwise, it will use the ServiceNow instance default timezone settings.
How to check the time zone settings of an account? Look for time_zone in the http get request of the following endpoint.
The datetime value is stored as UTC time in the ServiceNow table. If you set sysparm_input_display_value differently, then datetime value will be different too.
true: returns the display values for all fields.
false: returns the actual values from the database.
all: returns both actual and display values.
The display value varies based on the account settings, e.g timezone.