Subtract values in the for each row function

Hi,

I have a function within For Each Row that returns a date:
row.Item (2) .ToString

I need to subtract and add 30 days using this date as a reference

How can I do this without affecting the function?

1 Like

Hi @Guilas,

What do you need to subtract?

To Add 30 days you can use: row.Item(2).AddDays(30)

In this case, the value returned by row.Item(2) needs to be DateTime. Otherwise, convert it.

option strict does not allow late binding
Capturar

1 Like

What value does it return using only row.Item(2)?

Capturar

1 Like

It is String as I understood. Unless, you inserted row.Item(2).ToString instead of row.Item(2)

If it’s String, you need to Convert to DateTime first and then use function AddDays

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