How to Work with Time Format Data in Data.olllo AI Chat

With Data.olllo AI Chat, you can transform and format date/time data without memorizing complex syntax. Just describe what you need, and the AI will generate a ready-to-run process(dfs) function for you.

Example: Type your requirement and Data.olllo generates the correct code

Screenshot example: Enter your requirement → Data.olllo writes and runs the correct code

1. Convert Numeric Timestamps to Readable Dates

If your dataset stores time as Unix timestamps (e.g., 1691491200), convert them to human-readable datetimes:

def process(dfs):
    df = dfs["df"]
    df["timestamp"] = pd.to_datetime(df["timestamp"], unit="s")
    return df

2. Convert Datetime to Numeric Timestamps

Reverse the process and get seconds since Unix epoch for storage or comparison:

def process(dfs):
    df = dfs["df"]
    df["created_at"] = pd.to_datetime(df["created_at"]).astype("int64") // 10**9
    return df

3. Extract Specific Parts of a Date or Time

Get only the parts you need, like year or month:

def process(dfs):
    df = dfs["df"]
    df["year"] = pd.to_datetime(df["order_date"]).dt.year
    df["month"] = pd.to_datetime(df["order_date"]).dt.month
    return df

4. Convert String Dates to Datetime Objects

Turn text-formatted dates into real datetime objects:

def process(dfs):
    df = dfs["df"]
    df["date_str"] = pd.to_datetime(df["date_str"])
    return df

5. Format Datetime into Custom Strings

Output dates in your preferred style, e.g., MM/DD/YYYY:

def process(dfs):
    df = dfs["df"]
    df["created_at"] = pd.to_datetime(df["created_at"]).dt.strftime("%m/%d/%Y")
    return df

💡 Pro Tips

  • If your timestamps are in milliseconds, use unit="ms" in pd.to_datetime.
  • Always specify the exact column name and target format in your prompt.
  • You can combine multiple extractions, e.g., get both year and weekday.