How to Convert Relative Time to ISO Format Using ChatGPT
Ever scraped data and got annoying "2 days ago" instead of actual dates? Here's how to fix that using ChatGPT.
Check the YT video for step by step instructions.
When scraping posts, you often get relative time like "1 day ago" or "3 days ago". This becomes useless when you need to store or analyze the data later.
We'll use ChatGPT to convert these relative times into proper ISO format dates. Here's how:
Here's the exact prompt I use:
"You're a helpful assistant intelligent date conversion mathematician. Only answer with the date in format YYYY-MM-DD"
Tell ChatGPT what "today" means in your system. This is crucial for accurate calculations.
For example:
Let's say we're scraping on January 26th:
Q: Can't we just do this mathematically?
Q: What if the scraping runs over multiple days?
Q: Which ChatGPT version works best?
You could also:
But ChatGPT offers the quickest, most flexible solution.
Try this in your own scraping projects. If you need help with automations or have questions, email me at Adrian@timehackerslab(*dot)com
Remember: Always verify the converted dates against your source data first!