Good day! How to convert date strings to Int? Thank you

How to convert unicode to int?
I have a scenario i want to get the difference between 2 date.
Example my date format is:
a = 10/01/2020
b= 10/01/2020

print a - b
I want to get the value 0

Reference:

You can use other date functions to parse and look for days in between.

dateString1 = '09/24/2020'
dateString2 = '10/01/2020'
formatIn = 'MM/dd/yyyy'

date1 = system.date.parse(dateString1, formatIn)
date2 = system.date.parse(dateString2, formatIn)

print system.date.daysBetween(date1, date2)

2 Likes

To elaborate on Jordan’s answer:

Your mistake was to format your dates as strings. Strings are just blobs of characters and don’t know anything about what they hold, no matter what it looks like to you. Date objects do know how the various parts of the calendar work and can be asked to do math and comparisons accordingly.

3 Likes

Thanks sir , it works fine :grinning: :grinning:

In addition for my request, can i add additional column (column name = Days) after the Remarks to compute between days Closed Date - Target Date.


Thank you.

You’ll need to create an intermediate table for that: load your data to a custom property, and on property change, calculate the extra column and write it to the final table.