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

DateTime Functions

Feras95p
8 - Asteroid

Hi

 

 

Could you please guide me why the DateTime Functions don't work well with me as shown in the pictures attached ?

 

4 REPLIES 4
danilang
19 - Altair
19 - Altair

Hi @Feras95p 

 

For the highlighted row in 2.png, the Date Tim functions in Alteryx expect a fixed format with absolutely no variation in the input.  The format you're using "dd/MM/YYYY hh:mm:ss" will only match exactly that string, the date delimited by "/" followed by a single space followed by the time.  Your input has the Date(sometimes with "/" and sometimes with "-") followed by varying length text strings, followed by the time, usually with no seconds.  You need to extract the date part and the time part from your string before you can try to convert it.  A regex expression like 

 

 

regex_replace([Field1],".*?(\d+[-\/]\d+[-\/]\d+).*?(\d+:\d+)","$1 $2")

 

 

should remove the extra characters leaving you with just the date time info that you can then start to work with

 

Dan

 

 

 

  

lcrosby
7 - Meteor

Hi,

 

Any reason you have the square bracket ( [ ) at the start of the custom format string? I tried recreating this and, without that, it works fine.

Feras95p
8 - Asteroid

Thanks for replying I really appreciate that, as you said I have to make all the inputs at the same format to extract them, so how I can all of these input in the same format? any idea?


[11/04/2015 7:01:31 PM]

3/6/2016

3-6-2016

04_06_2016

7 / 6 / 2016

 

Feras95p
8 - Asteroid

Thanks for replying I really appreciate that, as you said I have to make all the inputs at the same format to extract them, so how I can all of these input in the same format? any idea?


[11/04/2015 7:01:31 PM]

3/6/2016

3-6-2016

04_06_2016

7 / 6 / 2016

Labels
Top Solution Authors