Search code examples
postgresqldatetimedate-formatting

change the date format ,column is of text data type


i have a table with column app_date (data type is text).i want to convert it to different format.Below are the examples

app_date 

Sep-17   
Jan-18  
Jun-16  

i want to convert it as

 new_app_date

 Sep2017
 Jan2018
 Jun2016

Solution

  • Use replace():

    update my_table
    set app_date = replace(app_date, '-', '20')
    returning app_date