Formatting Dates

How to format dates and time in your data extracts. We are going to use a method named TO_CHAR

You can read the full documentation for TO_CHAR here

🔗 Postgresql documentation

The following is an explnation and some snippets you can copy and paste.


Extracting the year with 4 digits.

1
TO_CHAR(extract_forecasting.movement_date, 'IYYY')

This example us using the the ISO 8601 week-numbering for formating the year with 4.

Understanding Postgresql methods and documentation

If you find postgres documentation intimidating and magic you can read this little introduction to postgresql.