Hi! I need help finding a way to change the date format 1/1/2022 to 01/01/2022. Can anyone provide a solution
Solved! Go to Solution.
Hi @kpontarollo
This might look tricky here is a way to tackle it.
1. Use datetimeparse() function to convert non-Alteryx date format to Alteryx dateformat. How datetimeparse work is you would need to give the format of the input date (DD/MM/YYYY) and it will convert it to Alteryx date (YYYY-MM-DD)
2. Once its converted to Alteryx date format we can use datetimeformat() to convert it back to the required format (DD/MM/YYYY)
Here is the documentation page of datetime functions go through it and you would be able to build these functions in no time https://help.alteryx.com/20214/designer/datetime-functions
The hack here is when Alteryx converts it to the required dateformat it adds zero 🙂 and will output as 01/01/2022
Once you have figured out the steps you can nest them into a single formula.
Hope this helps : )
Hi @kpontarollo
You can use the datetime functions:
First, parse into an alteryx supported date (yyyy-mm-dd), then, format back to your desired format. This assume you provided m/d/yyyy. Switch the %m and %d identifiers if your date is d/m/yyyy.
https://help.alteryx.com/20214/designer/datetime-functions
Thank you both so much, both have worked!
Hi! This worked great. Do you happen to have a fix for a problem that is one step more than this?
I need to make the date: 4/07/2021 5:00 to 04/07/2021 05:00:00?
Let me know! Thank you!
@kpontarollo I have assumed that this is DD/MM/YYYY. If so, you can use:
Datetimeformat(DateTimeParse([Input],"%d/%m/%Y %H:%M"), "%d/%m/%Y %H:%M:%S")
If it's MM/DD/YYYY, use:
Datetimeformat(DateTimeParse([Input],"%m/%d/%Y %H:%M"), "%m/%d/%Y %H:%M:%S")
Thanks!