How to convert String into date format in tableau?

How to convert String into date format in tableau?

After trying for 1.5 hrs i got the answer

   DateParse(yyyyMM, [Original Date])

or if you want 2016 Sept (1st 3 letters of the month)

left(datename(month,DateParse(yyyyMM, [original date])),3)

pick up first three alphabets.

Dateparse doesnt format a date it converts the date into Tableau format. The string specifying the format should specify the format of the date source not the date result (which is irrelevant as this will be in tableaus internal date format).

Once converted to a form Tableau can understand, you can format the date any way you want and manipulate the dates using all the built-in functionality that exists in Tableau for manipulating dates.

Despite the fact you have not specified a day in the original date string, doing this correctly as shown below will convert your string into a value of 1 April 2016 which you can format however you want:

Dateparse(yyyyMM,[Original Date])

Once you have the date in a format Tableau understands, you can use the Default Format:Date Format menu (right click the pill for the date variable to get this) and set whatever format you want.

How to convert String into date format in tableau?

To convert your Original Date string, you would need to do something like this:

Lets say your Original Date is 03Jan2016, you would need to tell tableau, in a way which it understands, how the format of the current string is, this is done like so:

LEFT (First 2 letters), MID(mid3 letters), Right(last 4 letters).

DATE (LEFT([Original Date],2) +
 / MID([Original Date],3) + / + RIGHT([Original Date],4))

Now make this match your current date, and it should be fine.

If it does not understand your current date format, it will give you its oldest date I guess.

This can also be found in their own KB article here:

Leave a Reply

Your email address will not be published. Required fields are marked *