Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.

change string date into different date formate

Sshasnk
8 - Asteroid

Hi I have a data set where I have diferent dates with different format which I want to change into dd-mm-yyyy

 

Input:

Date
2022-01-02
2022-01-03 13:45:41
2022-01-05
2022-01-03 13:45:45

 

Below formate is dd-mm-yyyy

Output:

Date
02-01-2022
03-01-2022
05-01-2022
03-01-2022 
4 REPLIES 4
Felipe_Ribeir0
16 - Nebula

Hi @Sshasnk 

 

One way of doing this

 

Felipe_Ribeir0_0-1668431805724.png

 

IraWatt
17 - Castor
17 - Castor

Hey @Sshasnk,

One way to approach this is just to use the date time tool and select the format you want to output to:

IraWatt_0-1668431816317.png

 

 

 

 

MarqueeCrew
20 - Arcturus
20 - Arcturus

@Sshasnk ,

 

This is what appears to be your challenge:  You have multiple date formats on input and you want to take those date values and change them into a string (non-ISO standard) format of MM/DD/YY.

 

The first part of the challenge is to normalize the dates (with and without time) by using a LEFT() function.

 

Left([Incoming Date],10)

 

Now all of your dates are in the format of YYYY-MM-DD

 

You now have a choice of how to solve this.   One, you can cheat and use the date-time tool (please don't do that until you understand how to format dates). Two, you can use a string function to move the last 5 characters to the left and take the first 4 characters and paste them with a - before it.

 

Right(Left([Incoming Date],10),5) + "-" + Left([Incoming Date],4)

 

And the final choice might be to learn how to use date specifiers (help document) with:

 

DateTimeFormat(left([Incoming Date],10),"%m-%d-%Y")

 

Cheers,

 

Mark

Alteryx ACE & Top Community Contributor

Chaos reigns within. Repent, reflect and restart. Order shall return.
Please Subscribe to my youTube channel.
KrishnaChithrathil
11 - Bolide

@Sshasnk 

KrishnaChithrathil_0-1668447177848.png

 

Labels