Getting Error while calculating differences between dates

Hello All,

I’m getting an error while calculating the differences between current date and the date from my excel (end_day). Both formats are same (YYYY-MM-DD)

Attached the screenshot of the error

Kindly let me know how to fix this issue.

Thanks

Hi @achyu!
You need to read data from Excel document by using “Read Excel Cell” activity and then change the format for every row.


You can also use a loop to process the data for each row where i variable is a value of the row:

2 Likes

Hi @achyu here is how you can calculate the date difference.

To calculate the date difference:

  1. Set two variables with a valid date format
  2. Add the Calculate difference activity
  3. Set the “Initial date” parameter using the variable name set in step 1 or use the “Set a value” picker
  4. Set the date to subtract the parameter using the variable name set in step 1 or use the “Set a value” picker
  5. Save the result using the Assign value to variable activity (added by default)

Note: Studio Pro also supports date management using the Moment Js library.

Example:

1moment().format('MMMM Do YYYY, h:mm:ss a'); // December 19th 2022, 7:47:27 pm 2moment().format('dddd'); // Monday 3moment().format("MMM Do YY"); // Dec 19th 22 4moment().format('YYYY [escaped] YYYY'); // 2022 escaped 2022 5moment().format();

Bear in mind that the MomentJs library methods must be used in the “Calculate a value” parameter of the Assign value to variable activity.