Parse Date 🧽📅
Danny Roden Administrator
edited November 2021 in Functions Library
This function is designed to have flexibility to accommodate all sorts of different date formats, which can be configured by the user. In addition to mapping the input, as you can see, the user is prompted for a 'format' when using this function and this can be configured intuitively as you can see in some of the below examples.
The function returns a date, parsing an input string based on the format supplied. Uses combinations of yyyy for year, mm for month and dd for day (with special characters defined as and if necessary).
See below for a screenshot with some example results displayed:
This function is compatible with all instances of Data Studio from v2.5.1 onwards.
Hey! You will be signed out in 60 seconds due to inactivity. Click here to continue using the site.
I've created a variation of this function that parses text into dates using the Regular Expression Replace function. Specifically, it uses regex capture groups to capture day, month and year separately and then use them as the replacement values, slash-separated in way that the "Convert To Date" function will understand.
While it sacrifices some of the usability of the function described above, it will be more efficient and is easier to understand if you understand the basics of regex.
This version of the function takes text input in the format ddMMyyyy, and converts it to a date. Some examples:
Search value regex:
$1/$2/$3(take the result of each capture group, separated by a forward-slash
This function is compatible with all instances of Data Studio from v2.7.6 onwards.