Removing "BC" from Timestamp dates in Postgresql

1

Hello, I'm trying to remove the "BC" from sql dates but I'm not getting it.
I do the following:

 SELECT CAST("regiaulaavul_dataInicio" AS date) FROM "RegistroAulaAvulsa"

And it turns out to return the date with a BC (Before Christ) in front. I would remove it to compare with the current date, which does not bring BC. Making comparisons between both returns incorrect result.



Thank you,
Lucas Kunze.

    
asked by anonymous 26.01.2017 / 13:06

1 answer

1

With the help of the comments and stackoverflow you could find the following solution:

to_char("regiaulaavul_dataInicio"::date, 'YYYY-MM-DD')::date

First a conversion was made to the string format and then to date, thus removing the "BC" and allowing comparison with other dates.

  
  • Comment from R.Santos
  •   
  • link
  •   
        
    26.01.2017 / 13:56