Advent of Code is back! Unwrap daily challenges to sharpen your Alteryx skills and earn badges along the way! Learn more now.
Free Trial

Alteryx Designer Desktop Discussions

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

i have one date Variable, which has dates in 2 format and i want to get it in one format

nidah5
8 - Asteroid

i Have date format in 2 type

1) yyyy-dd-mm hh:mm:ss

2) m/dd/yy hh:mm AM

How do i convert the dates into one standard format?

5 REPLIES 5
DavidP
17 - Castor
17 - Castor

Your 1st date is already in the standard Alteryx format so I would leave it like it is. To ensure that any date that is the in other format is converted to the correct format, I would use a formula like this:

 

if contains([date],'/') then DateTimeParse([date],'%m/%d/%y %I:%M %p') else [date] endif

 

DavidP_0-1594651137591.png

 

JosephSerpis
17 - Castor
17 - Castor

Hi @nidah5 I mocked up a workflow let me know what you think?

DavidP
17 - Castor
17 - Castor

My mistake, I misread the format of the 1st date, here is the updated formula

 

if contains([date],'/') then DateTimeParse([date],'%m/%d/%y %I:%M %p') else DateTimeParse([date],'%Y-%d-%m %H:%M:%S') endif

nidah5
8 - Asteroid

and how would i extract the month from the date column?

DavidP
17 - Castor
17 - Castor

Once the date field is an Alteryx date format, you can use the DateTimeMonth([date]) function to return the month as a number, or the DateTimeFormat([date],'%B') function to return the name of the month.

Labels
Top Solution Authors