# Why ChatGPT by API doesn't know today's date?

**URL:** <https://community.openai.com/t/why-chatgpt-by-api-doesnt-know-todays-date/449761>\
**Category:** API\
**Created:** [October 24, 2023, 1:55pm UTC](https://community.openai.com/t/why-chatgpt-by-api-doesnt-know-todays-date/449761 "2023-10-24T13:55:19Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![Genial](https://avatars.discourse-cdn.com/v4/letter/g/48db29/32.png) [@Genial](https://community.openai.com/u/Genial)\
**Post date:** [October 24, 2023, 1:55pm UTC](https://community.openai.com/t/why-chatgpt-by-api-doesnt-know-todays-date/449761/1 "2023-10-24T13:55:19Z")

</div>

Hello, I am currently developing an AI calendar which is a widget based on ChatGPT.

My problem is simple. When I ask for the date on chatgpt directly it gives me today’s date without any problem. When I make an API call, it is unable to give me today’s date.

My question is simple. Why and how can I solve that ??

Thanks in advance. Looking forward to reading you.

---

<div class="post-metadata">

**Author:** ![PaulBellow](https://sea2.discourse-cdn.com/openai1/user_avatar/community.openai.com/paulbellow/32/597962_2.png) [@PaulBellow](https://community.openai.com/u/PaulBellow)\
**Post date:** [October 24, 2023, 1:58pm UTC](https://community.openai.com/t/why-chatgpt-by-api-doesnt-know-todays-date/449761/2 "2023-10-24T13:58:15Z")

</div>

Welcome to the forum.

You could likely use a Function call that would query the date/time on your system then return it in natural language.

---

<div class="post-metadata">

**Author:** ![OnceAndTwice](https://avatars.discourse-cdn.com/v4/letter/o/cdc98d/32.png) [@OnceAndTwice](https://community.openai.com/u/OnceAndTwice)\
**Post date:** [October 24, 2023, 3:31pm UTC](https://community.openai.com/t/why-chatgpt-by-api-doesnt-know-todays-date/449761/3 "2023-10-24T15:31:45Z")

</div>

You have to supply the date and other relevant information yourself before the AI can make use of it. I recommend putting the date in the system prompt.

---

<div class="post-metadata">

**Author:** ![a.quinaz](https://sea2.discourse-cdn.com/openai1/user_avatar/community.openai.com/a.quinaz/32/146134_2.png) [@a.quinaz](https://community.openai.com/u/a.quinaz)\
**Post date:** [October 24, 2023, 4:55pm UTC](https://community.openai.com/t/why-chatgpt-by-api-doesnt-know-todays-date/449761/4 "2023-10-24T16:55:46Z")

</div>

AI Like Chat GPT is made out of Data. It is like a machine studying the data, once that machine studied the data, it will go to the market as a model.

This is why GPT does not know the date. Because it is based on data he has previously seen

---

<div class="post-metadata">

**Author:** ![\_j](https://sea2.discourse-cdn.com/openai1/user_avatar/community.openai.com/_j/32/766292_2.png) [@\_j](https://community.openai.com/u/_j)\
**Post date:** [October 24, 2023, 5:07pm UTC](https://community.openai.com/t/why-chatgpt-by-api-doesnt-know-todays-date/449761/5 "2023-10-24T17:07:55Z")

</div>

There’s no need for a “function call” for a date - although dealing with dates you will find it beneficial to add some functions that can compute or display calendars, because the AI won’t do a good job of querying for a question of “got any available appointments next tuesday?”.

Instead, I’d recommend two system prompt dates to keep the AI straight, because a system prompt that appears earlier than later chat exchanges can also serve to confuse the understanding of what’s going on if you provide the precision of time: “Conversation session start time” AND “current time”.

---

<div class="post-metadata">

**Author:** ![PaulBellow](https://sea2.discourse-cdn.com/openai1/user_avatar/community.openai.com/paulbellow/32/597962_2.png) [@PaulBellow](https://community.openai.com/u/PaulBellow)\
**Post date:** [October 24, 2023, 5:10pm UTC](https://community.openai.com/t/why-chatgpt-by-api-doesnt-know-todays-date/449761/6 "2023-10-24T17:10:37Z")

</div>

> [@PaulBellow](#):
>
> You could

Note I said you “could” not you “should”… 😉

Concur with the other answers that just inserting it into prompt from your system is better and it should be able to recall it when requested. Does use a bit more tokens, but the cost is dropping all the time.

---

<div class="post-metadata">

**Author:** ![Genial](https://avatars.discourse-cdn.com/v4/letter/g/48db29/32.png) [@Genial](https://community.openai.com/u/Genial)\
**Post date:** [October 27, 2023, 9:23am UTC](https://community.openai.com/t/why-chatgpt-by-api-doesnt-know-todays-date/449761/7 "2023-10-27T09:23:58Z")

</div>

This is the method I used and it works perfectly. Thanks for your help

---

<div class="post-metadata">

**Author:** ![Genial](https://avatars.discourse-cdn.com/v4/letter/g/48db29/32.png) [@Genial](https://community.openai.com/u/Genial)\
**Post date:** [October 27, 2023, 9:25am UTC](https://community.openai.com/t/why-chatgpt-by-api-doesnt-know-todays-date/449761/8 "2023-10-27T09:25:28Z")

</div>

Of course, my question is how OpenAI solves this problem on native ChatGPT but not on their API. And how I can fix that

---

<div class="post-metadata">

**Author:** ![Genial](https://avatars.discourse-cdn.com/v4/letter/g/48db29/32.png) [@Genial](https://community.openai.com/u/Genial)\
**Post date:** [October 27, 2023, 9:27am UTC](https://community.openai.com/t/why-chatgpt-by-api-doesnt-know-todays-date/449761/9 "2023-10-27T09:27:47Z")

</div>

> [@PaulBellow](#):
>
> Concur with the other answers that just inserting it into prompt from your system is better and it should be able to recall it when requested. Does use a bit more tokens, but the cost is dropping all the time.

Exact, works perfectly, thanks for your help 🙂

---

<div class="post-metadata">

**Author:** ![a.quinaz](https://sea2.discourse-cdn.com/openai1/user_avatar/community.openai.com/a.quinaz/32/146134_2.png) [@a.quinaz](https://community.openai.com/u/a.quinaz)\
**Post date:** [October 27, 2023, 5:28pm UTC](https://community.openai.com/t/why-chatgpt-by-api-doesnt-know-todays-date/449761/10 "2023-10-27T17:28:48Z")

</div>

Ohh, now I understand. If you are using the api in a programming setup, you can just send the current date using the libraries from the programming language. If I may help, please tell me what you are using!

---

<div class="post-metadata">

**Author:** ![Foo-Bar](https://sea2.discourse-cdn.com/openai1/user_avatar/community.openai.com/foo-bar/32/219437_2.png) [@Foo-Bar](https://community.openai.com/u/Foo-Bar)\
**Post date:** [October 27, 2023, 5:46pm UTC](https://community.openai.com/t/why-chatgpt-by-api-doesnt-know-todays-date/449761/11 "2023-10-27T17:46:29Z")

</div>

I can get the Unix Epoch time, when I request it.

Also you can fetch the timezone (it’s **[Zulu time](https://www.timeanddate.com/worldclock/timezone/zulu)**, or default to zero / 0).

See request : [Unix Epoch Date Request](https://chat.openai.com/share/9fc4a535-450c-4730-bb6d-c410939c26b9)

Knowing this, you can use it as a “default” and do the math for your API yourself.

---

<div class="post-metadata">

**Author:** ![dries.ketels](https://sea2.discourse-cdn.com/openai1/user_avatar/community.openai.com/dries.ketels/32/254598_2.png) [@dries.ketels](https://community.openai.com/u/dries.ketels)\
**Post date:** [December 18, 2023, 3:17pm UTC](https://community.openai.com/t/why-chatgpt-by-api-doesnt-know-todays-date/449761/12 "2023-12-18T15:17:43Z")

</div>

I am working with the assistant api. And had the best results with a function call that the assistant can use to request the time. Because assistants don’t have system prompt to my knowledge, and I still am debating your approach using prompts with session and current time. I was wondering if you have any success with such an approach for assistants?

---

<div class="post-metadata">

**Author:** ![logankilpatrick](https://sea2.discourse-cdn.com/openai1/user_avatar/community.openai.com/logankilpatrick/32/14116_2.png) [@logankilpatrick](https://community.openai.com/u/logankilpatrick)\
**Post date:** [December 18, 2023, 4:40pm UTC](https://community.openai.com/t/why-chatgpt-by-api-doesnt-know-todays-date/449761/13 "2023-12-18T16:40:19Z")

</div>

Yes, as noted, in ChatGPT we have a system that takes todays date and adds it to the system prompt. You can do the same!

---

<div class="post-metadata">

**Author:** ![logankilpatrick](https://sea2.discourse-cdn.com/openai1/user_avatar/community.openai.com/logankilpatrick/32/14116_2.png) [@logankilpatrick](https://community.openai.com/u/logankilpatrick)\
**Post date:** [December 18, 2023, 4:40pm UTC](https://community.openai.com/t/why-chatgpt-by-api-doesnt-know-todays-date/449761/14 "2023-12-18T16:40:28Z")

</div>

Closed on December 18, 2023, 4:40pm UTC


