Articles in this section
Category / Section

How to change string in DMY format to date in PostgreSQL data source in Bold BI?

Published:
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.

The second argument, `<date-format>` is the input format. 
Example:

Consider a column named `date` containing date strings in the 'dd-mm-yyyy' format. 



To convert the date strings to date values, use the following query:
to_date([date], 'dd-mm-yyyy')


This expression will return the date values for the column.


Related Links:

Was this article useful?
Like
Dislike
Help us improve this page
Please provide feedback or comments
PK
Written by Poovarasan Kandasamy
Updated
Comments (0)
Please  to leave a comment
Access denied
Access denied