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

Alteryx Designer Desktop Discussions

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

Date as String - How to convert to Date

brendafos
10 - Fireball

I've spent some time reading other posts but I've not quite gotten the answer I need.....

 

The incoming data has a field type v_string which looks like 5/8/2015 -- I need to convert this to a type date.

 

I tried the Select tool changing v_string to date but that just outputs 'null's.

 

I tried -

DateTimeParse(
  REGEX_Replace([Text], "([a-z]{3})\s*([0-9]{1}),","$1 0$2,"),
  "%b %d,%Y")

But that gives 'null' and does not give an error.

 

string to date type.png

 

Can I use DateTimeParse with a string type?

Or how is the best way to approach this? 

11 REPLIES 11
brendafos
10 - Fireball

OK, thanks.  I can handle that.

Aguisande
15 - Aurora
15 - Aurora

Hi,

You always have the DateTimeFormat() function to "convert" the Date fields to a String with the format you want, using the same masks you use to convert them from strings. So you can "operate" with the Date type field, but use the formatted string for presentation purposes.

Eg: 

DateTimeFormat([Date_Field],"%b %d, %Y") --> Will give you "May 30, 2016"

 

Best,

_AG_

Labels