Extract the date from excel and calculate the time diffrence in minutes

Dear Team,

Attaching the excel file, please check why the datevalue is coming from excel not able to convert it into datetime for datetime calculations.Cell “I2” has a date and “J2” has a time, we have to convert it into datetime and calculate the diffrence in minutes from Date.Now

Date test.xlsx (58.6 KB)

Thanks,
Amol Golhar

Hi @Amol_Golhar .

Raad excel data with help of read value and then

Convert.ToDateTime(Datetime.ParseExact(DateTime.Now.ToString(“MM/dd/yyyy”),“MM/dd/yyyy”,System.Globalization.CultureInfo.InvariantCulture))-Convert.ToDateTime(Datetime.ParseExact(DateTime.Now.ToString(“MM/dd/yyyy”),“MM/dd/yyyy”,System.Globalization.CultureInfo.InvariantCulture))

Use this formula to get the difference

@Amol_Golhar

  1. Excel Application Scope activity
    Read Cell activity “I2” into dateValue
    Read Cell “J2” into timeValue

  2. Assign combinedDateTime = dateValue & " " & timeValue

  3. Assign combinedDateTime = DateTime.ParseExact(combinedDateTime, “MM/dd/yyyy HH:mm:ss”, CultureInfo.InvariantCulture)

  4. Assign timeDifference = combinedDateTime.Subtract(DateTime.Now)

  5. Assign minutesDifference = timeDifference.TotalMinutes

// Use or display the minutesDifference variable as needed

Hey @Amol_Golhar
try to use vb.net:

Dim datePart As DateTime = DateTime.Parse(dateString)
Dim timePart As DateTime = DateTime.Parse(timeString)
Dim combinedDateTime As New DateTime(datePart.Year, datePart.Month, datePart.Day, timePart.Hour, timePart.Minute, 0)

Dim now As DateTime = DateTime.Now
Dim difference As TimeSpan = now.Subtract(combinedDateTime)
Dim minutesDifference As Double = difference.TotalMinutes

Dear Team,

I tried all above ways, Can any one share workflow by using the attached excel file.

Thanks,
Amol Golhar

Hi @Amol_Golhar

Can you try the below

BlankProcess19.zip (95.8 KB)

Cheers!!

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.