Hi,
I want to calculate differences between Datetime field and number field.
Any help would be appreciated!
Thanks in advance,
Kind regards,
Résolu ! Accéder à la solution.
Hey @acaryasin01,
All the datetime functions are here DateTime Functions | Alteryx Help. Can you be more specific in what you are trying to achieve, it is possible to add or subtract a given number of days or months for example from a date. However you cant for instance do 15 minus 1970-01-01 as that does not make sense.
Hello. Just make sure to check the data type of your the fields you want to calculate the differences. Use a Select Tool and make sure you change the data type to a numeric data type. You can use a formula tool afterwards to calculate the difference.
To clarify it a bit more;
I have double data type field and I want to subtract the*is field from the Datetime field.
Days | Date | Diff (Desired Column) | |
2 | 5-8-2022 00:00 | 3-8-2022 00:00 | |
3 | 19-10-2022 00:00 | 16-10-2022 00:00 | |
55 | 3-8-2022 00:00 | 9-6-2022 00:00 | |
6 | 29-9-2022 00:00 | 23-9-2022 00:00 | |
11 | 26-10-2022 00:00 | 15-10-2022 00:00 |
Hey @acaryasin01,
Here is one way to do this:
First convert you date field to a date data type with the date time tool then use the DateTimeAdd function to subtract the days.
If your interested in learning more about the datetime functions there is a great cheat sheet Blog here: https://community.alteryx.com/t5/Engine-Works/DateTime-Functions-Cheat-Sheet/ba-p/844353.
Any questions or issues please ask
Ira Watt
Technical Consultant
Watt@Bulien.com