Alteryx Designer Desktop Discussions

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

how do I convert 31-Dec-2018 to 12/31/2018 using the formula tool?

htalteryx
8 - Asteroid

Thanks!

5 REPLIES 5
Thableaus
17 - Castor
17 - Castor

Hi @htalteryx 

 

Try this:

DateTimeFormat(DateTimeParse([Field1],"%d-%b-%Y"), "%m/%d/%Y")

Screen.PNG

 

 

Cheers,

cmcclellan
13 - Pulsar

I was confused by your post, but I think I figured it out.

 

When Alteryx is using dates, the format it always yyyy-mm-dd

 

So I'm guessing you're using a string that contains "31-Dec-2018" or more precisely "dd-mmm-yyyy".  If the string is called [string_date] then use this:

 

DateTimeFormat(
	DateTimeParse([string_date],'%d-%b-%Y')
,'%m/%d/%Y')

2019-02-08 07_52_48-Alteryx Designer x64 - New Workflow13_.png

 

 

The DateTimeParse turns the string into a date, which makes it easy to do the DateTimeFormat and show in the format that you want.

htalteryx
8 - Asteroid

Thank you so much!  I've been looking everywhere for this!  I would never have figured this out on my own!

 

One more question:  how do I convert 2018-12-31 to 12/31/2018 using the formula tool?

Thableaus
17 - Castor
17 - Castor

@htalteryx 

 

Use the second part of mine and @cmcclellan solution.

 

DateTimeFormat("%m/%d/%Y") 

 

Cheers,

htalteryx
8 - Asteroid

Thanks!  I figured it out.

Labels