Datetimeformat function
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Hi, I have a question regarding the Datetimeformat function.
I had two different formats (strings) in my Date column:
4/19/2022 1:52:16 AM
5-3-2022 03:47
First, I've used the DateTime tool to change the dates to the same DateTime format:
2022-04-19 01:52:16
2022-05-03 03:47:00
Now I would like to change the format to
19-04-2022 01:52:16
03-05-2022 03:47:00
When I use the formula tool and type in the next function, I only get Nulls.What am I doing wrong here?
DateTimeFormat([Date], '%d-%m-%Y %H:%M:%S')
Solved! Go to Solution.
- Labels:
- Date Time
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Hi @sophievanluin,
I tried it and it works fine on my side, only thing you have to do is create a new column, not trying to replace the data you have in this column since it's a date and the only valid date format in alteryx is year-month-day.
I guess you try to modify the Date column, in your case, you shoudl create a new one :)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Hey @sophievanluin, I've tried your formula and it seems to be working fine (below):
However, it is important to note that Alteryx outputs datetimeformat() as a string. Are you perhaps changing the output data type to DateTime? As that will cause a null:
If you need the output as DateTime, you can stick another DateTime tool on the end of your output string as so:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Hey @sophievanluin,
That's strange seems to work fine for me. Is your output of type Date, that would cause the NULLs. Can you send a screenshot of your workflow?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
@sophievanluin I don't see any issues with the formula as well. Attaching a sample workflow for your reference. you can compare this workflow with the one which you created
