Bengaluru, IN

Welcome to the Bengaluru User Group

Click in the JOIN GROUP button in Home to follow our news and attend our events!

Convert date into number

Neeta_Latwal
7 - Meteor

Hi All,

 

Please help me alteryx tool:-

 

DateNumber (desire result)
2023-01-1144,937.00
2023-01-0344,929.00
2023-01-2744,953.00
  

Thanks,

3 REPLIES 3
p-g
8 - Asteroid

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:

  1. Open Alteryx Designer.
  2. Drag and drop a Formula tool onto your workflow canvas.
  3. 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.
  4. 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! 😊

 
Neeta_Latwal
7 - Meteor

If i deduct 44929 from dates it will not give standard date as 1899-12-30

DateNumber
date-1(deducted 44929 from date
2023-01-1144,937.001900-01-07
2023-01-0344,929.001899-12-30
2023-01-2744,953.001900-01-23
p-g
8 - Asteroid

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.