When I use the formula tool to give me the date in the following format (mmddyyyy) as a string, I get MDDYYYY when it is a month before October,
How can I get 04 or 08 instead of 4 or 8. and is there an easier way to do this.
Formula used:
"ToString(DateTimeMonth([Date]))+tostring(DateTimeDay([Date]))+tostring(DateTimeYear([Date]))"
Thanks in advance.
V
Solved! Go to Solution.
@Vsridharan Try this: DateTimeParse([Date],'%m%d%Y')
I tried using the formula, but I am getting a null on the result.:(
@Vsridharan Can you please upload some dummy data just so I can put the data into a workflow?
@Vsridharan This is the workflow I'm using.
But I am basically using a text input tool for just 1 Column with a header called date and only 1 row with the value "2023-10-20".
I was testing different dates with the date interface tool.
@Vsridharan Try this one.
Thank you so much, This is perfect. and thanks to your solution I got to learn about Padleft and padright as well.
However I still do not understand why the first file you uploaded with the parse function had hyphens despite the formula [ DateTimeParse([Date],'%m%d%Y') ] not having any in it.
Thanks,
V
@Vsridharan Check out this help page. It's been super helpful to me over the years: https://help.alteryx.com/20231/designer/datetime-functions. DateTimeParse is looking for a field that has your date in it, regardless of format. This part of the expression "%m%d%Y" identifies the current state of the date. "%m" means a 2-digit month, "%d" means a 2-digit day, and "%Y" means a 4-digit year. I identified my original date field as being in that format, so the expression turned the data into an actual date that Alteryx recognizes, or YYYY-mm-dd.