This report investigates how Gemini handles current time information, particularly when using the Gemini API. We found that while the Gemini web interface knows the current time, the Gemini API does not inherently. Therefore, applications must explicitly provide current time information in API calls for accurate time-sensitive responses.
The rapidly advancing field of generative AI is enabling increasingly complex tasks, particularly through the use of open protocols like the Model Context Protocol (MCP) and Agent2Agent (A2A) Protocol. These protocols facilitate sophisticated operations that often require accurate and dynamic information, including time-sensitive data. For instance, applications that manage schedules or coordinate events critically depend on precise time information.
During the development of a schedule management application leveraging these open protocols and the Gemini API, an unexpected behavior was observed regarding Gemini's handling of "current time." This led to a focused investigation, the results of which are summarized in this report. Our testing revealed that, at its current stage, direct interactions with the Gemini API require explicit inclusion of current time information within the input. This means developers must actively provide relevant time data as part of their API calls, rather than relying on Gemini to independently ascertain the current time. This finding is crucial for anyone building applications that need to operate with real-time awareness or manage time-dependent processes when integrating with the Gemini API.
In this experiment, the following prompts were used:
- What time is it now?
- Return the current time in 'yyyy-MM-dd HH:mm:ss' with the timezone of 'Asia/Tokyo'. Return only the result.
- I will have lunch the day after tomorrow. In order to create it as an event on Google Calendar, please return the date and time of the lunch in the format 'yyyy-MM-dd HH:mm:ss' with the timezone of 'Asia/Tokyo'. Return only the result.
The timezone used depends on each user. The first prompt is a simple request for the current time. The second returns only the current time in the 'yyyy-MM-dd HH:mm:ss' format. The third returns the time for the day after tomorrow, in the same format as the first, by interpreting the schedule.
First, these prompts were used with Gemini and Google AI Studio.
Next, these prompts were used in a Python script. The sample script is as follows:
from google import genai
from datetime import datetime
apiKey = "###" # Please set your API key for using Gemini API.
model = "gemini-2.5-flash-preview-05-20"
prompt = "What time is it now?"
now_date_time = datetime.now().strftime("%Y-%m-%d %H:%M:%S")
print(f"From datetime: {now_date_time}")
client = genai.Client(api_key=apiKey)
response = client.models.generate_content(model = model, contents = prompt)
print(f"From Gemini: {response.text}")
The experiment was conducted on 2025-06-06.
In the case of Gemini, the correct times were returned for all prompts.
Prompt 1
Prompt 2
Prompt 3
In the case of Google AI Studio, no time was returned from "Prompt 1". The incorrect dates were returned for "Prompt 2" and "Prompt 3", and the values of the dates were randomized. At "Prompt 3", the time was correct. It is considered that the time was generated from the prompt.
Prompt 1
Prompt 2
Prompt 3
The results using the model gemini-2.5-flash-preview-05-20
are as follows:
Prompt 1
From datetime: 2025-06-06 13:47:53
From Gemini: From Gemini: The current time is **12:08 PM UTC** on **May 16, 2024**. Please note that this is Coordinated Universal Time (UTC). You may need to adjust for your local time zone.
Prompt 2
From datetime: 2025-06-06 13:49:10
From Gemini: 2024-07-28 01:21:28
Prompt 3
From datetime: 2025-06-06 13:49:53
From Gemini: 2023-10-28 12:00:00
In all prompt patterns, an incorrect date was returned. However, the time was correct for "Prompt 3". At "Prompt 3", it is considered that the time was generated from the prompt. In this case, even when the models were changed, the correct dates couldn't be returned from Gemini API.
From the experimental, the following results were obtained.
- At Gemini, Gemini knows correctly the today's date.
- At Google AI Studio and Python, Gemini doesn't know correct today's date.
In order to confirm why Gemini has the correct today's date, I asked it using the following prompt.
Where do you get the correct today's date when you currently generate content in this request?
Gemini returned as follows.
I am provided with the current date and time as part of my operating parameters for each request. This information is accurate and up-to-date. Therefore, I know that today's date is Friday, June 6, 2025.
Google AI Studio and Python returned a similar answer as follows.
As a large language model, I don't have real-time access to the internet, a built-in clock, or the ability to know the current date. My knowledge is based on the data I was trained on, which has a specific cutoff date. Therefore, when I generate content, I don't "get" today's date from anywhere. I simply don't know what the current date is. If you ask me for the date, I can only tell you about my knowledge cutoff or state my inability to know the current date.
From those results, it is considered that when the correct today's date is given to Gemini API, even when Python is used, the correct date can be used. So, I updated the above script as follows. In this update, the current time was given in system_instruction
. Ref I think that even when the current time is included in the prompt, the correct time can be used for generating content.
from google import genai
from google.genai import types
from datetime import datetime
apiKey = "###" # Please set your API key for using Gemini API.
model = "gemini-2.5-flash-preview-05-20"
prompt = "What time is it now?"
now_date_time = datetime.now().strftime("%Y-%m-%d %H:%M:%S")
print(f"From datetime: {now_date_time}")
system_instruction = [
"You can generate content using the information giving as follows.",
"# Current information",
"Timezone is 'Asia/Tokyo'",
f"Current time is '{now_date_time}' in the format 'yyyy-MM-dd HH:mm:ss'.",
]
client = genai.Client(api_key=apiKey)
response = client.models.generate_content(
model = model,
contents = prompt,
config=types.GenerateContentConfig(system_instruction="\n".join(system_instruction))
)
print(f"From Gemini: {response.text}")
When this script is used, the following results were obtained.
Prompt 1
From datetime: 2025-06-06 14:43:06
From Gemini: The current time is 14:43:06 on June 6, 2025 (JST).
Prompt 2
From datetime: 2025-06-06 14:45:25
From Gemini: 2025-06-06 14:45:25
Prompt 3
From datetime: 2025-06-06 14:45:48
From Gemini: 2025-06-08 12:00:00
The correct times could be obtained for all prompts.
Also, when I used a prompt of Where do you get the correct today's date when you currently generate content in this request?
, the following result is returned.
I get the correct today's date from the "Current information" provided to me within this request.
Based on that information: Today's date is 2025-06-06.
This report investigated Gemini's handling of current time information, especially when integrating with the Gemini API.
- When directly using the Gemini web interface, Gemini accurately provides the current date and time.
- When using the Gemini API via Google AI Studio or a Python script, Gemini does not inherently know the current date and time.
- To enable Gemini API to provide correct time-sensitive responses, the current time information must be explicitly passed in the API call (e.g., via
system_instruction
or within the prompt). - By explicitly providing the current time in the API request, applications can successfully manage and operate with real-time awareness using the Gemini API.