title: Casting a string to Date and Time in PostgreSQL
body: <p>I have a table in GreenPlum (PostgreSQL) with all fields as sting, and I want to edit the types :</p>
  
  <p>To do this I created a view : </p>
  
  <pre><code>CREATE VIEW typed_view AS
  
  SELECT CAST(sid AS bigint), CAST(gid AS bigint),
  </code></pre>
  
  <p>...</p>
  
  <p>But I have a problem with the Date and Time fields, I tried this command but it didn't work :</p>
  
  <pre><code> to_utc_timestamp(from_unixtime(unix_timestamp(eventdatetime,"yyyy-MM-dd
  </code></pre>
  
  <p>HH:mm:ss")),'UTC') AS eventdatetime,</p>
  
  <p>After that I tried the PostgreSQL notation : </p>
  
  <pre><code>to_timestamp(eventdatetime, 'YYYY Mon DD HH24 MI SS') AS eventdatetime,
  </code></pre>
  
  <p>But still not working.</p>
  
  <p>Anyone knows how to convert it ?</p>
  
  <p>I also have this command that is not working : </p>
  
  <pre><code>CASE WHEN fix = "True" THEN TRUE ELSE FALSE END AS fix,
  </code></pre>
  
  <p>Thanks in advance</p>