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!