I tried 2 different methods to parse a date i have "26/07/2018", which is a string
1. Used the datetime tool, the output is "2026-07-20 18:00:00"
2. Used the formula "DateTimeParse([Date],"%Y-%m-%d %H:%M:%S")", the output is "2026-07-20 18:00:00"
I need the output: 26-07-2018 18:00:00 in datetime data type
Not sure where i am going wrong, requesting your help
Solved! Go to Solution.
Unfortunately you can't have that format as a 'datetime' type as that is only available for a specific date format in Alteryx: yyyy-MM-dd.
You can get the format you want as a 'string' by:
First converting your date to a 'datetime' type,
Second converting the format stored as a 'string' type. Make sure you string size is large enough to fit everything (at least 20).
Step 1
Convert the date string to 'datetime' type
Formula Tool
DateTimeParse([Date],'%d/%m/%Y')
DateTime Parse Tool
dd/MM/yyyy
Step 2
Add 18 hours to your datetime
Format Tool
DateTimeAdd([Date (Converted)],18,'hours')
Step 3
Convert your datetime back to a 'string' type in the format you want
Formula Tool
DateTimeFormat([Date (Converted)],'%d-%m-%Y %H:%M:%S')
Formula Tool