DEV Community

Discussion on: Understanding Data Types in Supabase

Collapse
 
dhaggerfin profile image
David • Edited

I found this article when struggling to figure out how to get a date into Supabase. For me the solution was to convert it to iso format first. Python snippet:

def convert_date_to_iso(datetime_string):
    return datetime.strptime(datetime_string, DATE_FORMAT).isoformat()
Enter fullscreen mode Exit fullscreen mode

And then the insert:

data = supabase.table("mytable").insert({
    "timestamp": convert_date_to_iso(datetime_string)
}).execute()
Enter fullscreen mode Exit fullscreen mode