Converting datetime format with AM/PM

Hi,

I got a CSV file with a column named Time that contains a DateTime format like this one:

4/25/2016 09:30:00 PM

All the cells contains data like this

SQL doesn’t recognize this kind of format

I would like:

  1. Import the data in the right format

  2. Separate Date form Time in two separate cells

  3. Replace the old Time column with the the new correct ones

Hi @FedericoM ,

Welcome to Google Cloud Community!

  1. SQL can’t directly convert your datetime format: While SQL doesn’t handle AM/PM directly, Python’s pandas library can.
  2. Use Python’s pandas to manipulate data: Read your CSV into a pandas DataFrame, parse the datetime with format, and separate date and time into separate columns.
  3. Save the modified DataFrame: Save the DataFrame with new columns to a new CSV file.
    This approach provides a flexible solution for working with your specific datetime format and preparing data for further processing in SQL or other tools.