Convert date into number
- 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 All,
Please help me alteryx tool:-
Date | Number (desire result) |
2023-01-11 | 44,937.00 |
2023-01-03 | 44,929.00 |
2023-01-27 | 44,953.00 |
Thanks,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
When we subtract 44,929 days from 2023-01-03, we get the resulting date of 1899-12-30. Add a column "Number" using formula tool and leverage DateTimeDiff formula to find the difference between the base date and Date column values.
DateTimeDiff([Date],"1899-12-30",'days')
In Alteryx, you can subtract two dates using the DateTimeDiff function. Let’s break down the steps:
- Open Alteryx Designer.
- Drag and drop a Formula tool onto your workflow canvas.
- Configure the Formula tool:
- Select the field containing your first date (let’s call it Date1).
- Select the field containing your second date (let’s call it Date2).
- Create a new field (let’s call it DateDifference) where you want to store the result.
- In the formula expression, use the following syntax:
DateTimeDiff([Date2], [Date1], 'days')
This will calculate the difference in days between Date2 and Date1.
- Run your workflow to see the calculated date difference in the DateDifference field.
The result will be an integer representing the number of days between the two dates. If you need to include fractions of a day (such as hours or minutes), you can adjust the formula accordingly.
Remember to replace days with other time units (e.g., minutes, months, years) if needed.
If you have any more questions or need further assistance, feel free to ask! 😊
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
If i deduct 44929 from dates it will not give standard date as 1899-12-30
Date | Number | date-1(deducted 44929 from date |
2023-01-11 | 44,937.00 | 1900-01-07 |
2023-01-03 | 44,929.00 | 1899-12-30 |
2023-01-27 | 44,953.00 | 1900-01-23 |
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Refer to the updated version of my response above. Instead of subtracting 44929, from the dates, subtract the date "1899-12-30", that should give you your numbers.
