How to change string in DMY format to date in PostgreSQL data source in Bold BI®?
Converting string in DMY format to Date in PostgreSQL
In the PostgreSQL data source, you may need to convert a date string in different formats to date column. The default conversion only allows for mdy format. This article will guide you on how to convert a date string from the 'dd-mm-yyyy' format to date values.
Steps to Convert Date String Format:
1. Identify the column containing the date string in your table. The datatype of the column must be of the string type.
2. Use the `to_date` function to convert the date string format.
Here's the expression to convert the string to date:
to_date([your column name], '<date-format>')
The first argument is the string that you want to convert to a date. Replace `your column name` with the actual column name containing the date string.
Example:
Consider a column named `date` containing date strings in the 'dd-mm-yyyy' format.
to_date([date], 'dd-mm-yyyy')
This expression will return the date values for the column.
Related Links:
- Configuring Expression Columns
- PostgreSQL Date/Time Functions and Operators.
- PostgreSQL Date/Time Types.
- PostgreSQL Function formatting