Task completion time is off by several hours

Hi,

I built a desktop task management client with PySimpleGUI. When I change a task status to complete and click the "Sync" button, the task information is registered into my Kintone app.

But the time shown in the Kintone app is several hours different from the time I sent.

This is the part of my code that does the HTTP communication:

import requests
import datetime

APP_ID = my_app_id
SUBDOMAIN = my_subdomain
API_TOKEN = my_api_token
FIELD_TASK_NAME = task_name
FIELD_PROJECT = project
FIELD_COMPLETED_TIME = completed_time


def sync_to_kintone(task_name, project, completed_time):
    url = f"https://{SUBDOMAIN}.kintone.com/k/v1/record.json"
    headers = {
        "X-Cybozu-API-Token": API_TOKEN,
        "Content-Type": "application/json"
    }

    payload = {
        "app": APP_ID,
        "record": {
            FIELD_TASK_NAME: {"value": task_name},
            FIELD_PROJECT: {"value": project},
            FIELD_COMPLETED_TIME: {"value": completed_time}
        }
    }

    response = requests.post(url, headers=headers, json=payload)
    return response.json()

now = datetime.datetime.now().strftime("%Y-%m-%dT%H:%M:%S")
sync_to_kintone("Write report", "Project A", now)

There is no error. The API returns a success response and the record is created normally. Only the completed_time value is wrong.

For example, if I complete a task at 5:00PM on my PC, I send 2026-07-01T17:00:00 to kintone. But in the kintone app it shows a different time, some hours earlier. I want the completed_time in kintone to match the time on my computer. What am I doing wrong with the datetime value? Is my format missing something?

Thanks in advance!

Hello @Sally

Welcome to the community!

Based on the datetime value you shared, one thing I noticed is that the value being sent to Kintone does not include timezone information.

For Date and Time fields, Kintone expects the datetime value to include either a UTC offset or Z to indicate UTC. For example, if the intended time is 5:00 PM Pacific Daylight Time, the datetime value would need to include the UTC-7 offset. Alternatively, you could convert the local time to UTC before sending it to Kintone.

Since your current value only specifies the date and time without a timezone, I would first try sending a timezone-aware datetime value and see if that resolves the time difference.

It may also be worth checking the timezone configured for the Kintone user if the displayed time still differs from what you expect.

I hope this helps!