Skip to main content

Apologies in advance for the essay, but this is just one issue I’ve had using functions in Data Designer caused by lack of clarity in the documentation.

I am adding a formula field to a data design to convert a string field to a date field. The string field contains only dates written in the format “YYYY-MM-DD”. I am attempting to use the “To Date” function to change the data type. The documentation has only the following information on this function:

To Date: This parameter returns any string data type field or value containing date into the Date format provided by the user.
Note: If the date format is not provided, the default value considered is yyyy-MM-dd
.”

What the documentation does not explain is how this should actually be entered into the function as it appears in data designer. I enter the name of the field I wish to convert then it prompts for “Format of Date” - it looks like I should have options to select but there’s nothing there. See below:

I entered “dd-mm-yyyy” here (which I think is what I’m supposed to do?) and then it prompts for a default value. I assume that this is meant to be the value that is provided in the case that the field is empty for a particular row? In my case, I want this to be NULL. 

What I get when running the preview of the output of the Transform, however, is every row having NULL as the output. 

“Date” in this case is a string field
​​​

Can someone please explain what the proper way to achieve what I need here? Also, can the documentation can be updated to provide more detailed descriptions of exactly how all formula should be entered.

An update - I changed format to “yyyy-mm-dd” and I’m no longer getting blank values, now I’m just getting wrong values

Only yyyy seems to be pulling through correctly?


Wierd, I thought we show atleast top supported formats

Either way I heard internally on why you are facing this challenge, It should be yyyy-MM-dd instead of yyyy-mm-dd


@corrie_amo Could you try all caps? I think I had a similar issue in the past that had me hunting down a format reference doc. See here

 

I can’t recall what exactly the issue I had was or if this resolved it, but if GS requires standard syntax for the date format, it would be MM-DD-YYYY (rather than mm-dd-yyyy). Seems silly but worth a shot if you’re still looking for a solution to this.


Reply