Make.com - Relative dates (13h ago) into ISO date and vice versa

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.



The Problem


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.



The Solution


We'll use ChatGPT to convert these relative times into proper ISO format dates. Here's how:


  • First, establish today's date in your system
  • Create a ChatGPT prompt with specific formatting rules
  • Feed it the relative times and get exact dates back


  • The ChatGPT Prompt


    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"



    Setting Up The System Date


    Tell ChatGPT what "today" means in your system. This is crucial for accurate calculations.


    For example:


  • Today = 2024-01-26
  • "3 days ago" = 2024-01-23
  • "20 hours ago" = 2024-01-25


  • Real World Example


    Let's say we're scraping on January 26th:


  • Post shows "5 days ago"
  • ChatGPT calculates: 2024-01-21
  • Verification: Checked against original post - matches perfectly


  • FAQ


    Q: Can't we just do this mathematically?


  • A: Yes, but ChatGPT makes it simpler and handles edge cases better

  • Q: What if the scraping runs over multiple days?


  • A: Always pass the current system date to ensure accuracy

  • Q: Which ChatGPT version works best?


  • A: I use GPT-4 via OpenRouter, but GPT-3.5 should work too


  • Alternative Solutions


    You could also:


  • Find a scraper that gives exact timestamps
  • Use a date parsing library
  • Build your own date calculator

  • But ChatGPT offers the quickest, most flexible solution.



    Next Steps


    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!

    More educational blogs: