skip to Main Content

I should somehow convert data type to easily insert into table with datetime format.
From

2022-11-28T12:18:46.534919023Z

To
2022-11-28 12:18:46

BTW using PostgreSQL.
Any ideas how to do it?

2

Answers


  1. SELECT CAST( '2022-11-28T12:18:46.534919023Z' AS timestamp)
    

    Result

    More about CAST PostgreSQL CAST

    Login or Signup to reply.
  2. There is no conversion necessary. The indicated value 2022-11-28T12:18:46.534919023Z can be directly inserted into a timestamp with time zone (timestamptz) column. See demo

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search