In ChatGPT, is there a way I can search for chats by specific dates?
Unfortunately, you can’t currently search by calendar date directly in ChatGPT, but you can export your data and search that instead.
Step 1: Export Your Data
Follow ChatGPT’s docs on how to export your data:
- Go to Settings → Data Controls → Export Data.
- You’ll get a ZIP with JSON and an HTML file (
chat.html).
Step 2: Edit chat.html
Edit chat.html and update the window.onload function:
- Sort
jsonDatabycreate_time. - Render
create_timenext to conversation heading.
// on load, add messages to the root div
window.onload = function() {
var root = document.getElementById("root");
+ // 1. Sort conversations by `create_time`.
+ jsonData.sort((a, b) => b.create_time - a.create_time);
for (var i = 0; i < jsonData.length; i++) {
var conversation = jsonData[i];
var messages = getConversationMessages(conversation);
var div = document.createElement("div");
div.className = "conversation";
+ // 2. Render `create_time` next to conversation heading.
- div.innerHTML = "<h4>" + conversation.title + "</h4>";
+ div.innerHTML = `
+ <span style="display: inline-block; background: yellow; margin-bottom: 1em; padding: 0.5em; font-weight: bold;">
+ ${(new Date(conversation.create_time * 1000)).toLocaleString()}
+ </span>
+ <h4>${conversation.title}</h4>
+ `;
for (var j = 0; j < messages.length; j++) {
var message = document.createElement("pre");
message.className = "message";
Bonus: If you want to make it easier to scan and scroll through your chat history, you can add some quick styles to .conversation too:
.conversation {
border: 1px solid black;
padding: 20px;
background-color: #f3f3f3;
+ /* Bonus: Make conversations easier to scan and scroll through. */
+ max-width: 960px;
+ max-height: 300px;
+ margin-inline: auto;
+ overflow: auto;
}
Step 3: Open chat.html
Now you should have a date-searchable chat history.
