Compre dates in column datatable

Hello friends,
@rkelchuri, @Ninett_Panfir, @Rammohan91, @balupad14, @Florent_Salendres, @vvaidya, @Palaniyappan, @loginerror, @MAHESH1


How to compare the value in the column “Data validità” with Today?
I want to check if it is greater than today.
Cami

1 Like

Fine
lets take like the above image gives us a datatable named dt
–now use a for each row loop and pass the above variable as input
–inside the loop use a IF condition like this
Datetime.ParseExact(row(“yourcolumnname”).ToString,“dd/MM/yyyy”,System.Globalization.CultureInfo.InvariantCulture) > Datetime.Now
if true it will go to THEN part or to the ELSE part

hope this would help you
kindly try this and let know for any queries or clarification
Cheers @CamiCat

1 Like

I would do a little change :wink: Datetime.ParseExact(row(“yourcolumnname”).ToString,“dd/MM/yyyy”,System.Globalization.CultureInfo.InvariantCulture) >= Datetime.Now.Date

1 Like

Thank you so much @Palaniyappan.
I’ll try and let you know as soon as possible.
Cami :slight_smile:

1 Like

Cheers buddy @CamiCat

Hello @Palaniyappan,

Tabella_input.Select(“[Data fine validità DURC] < #”+DataOdierna+“#” Or [Data fine validità DURC] is NULL).CopyToDataTable
Which errore I’m inserting in this query?
Cami

The expression be like this
Tabella_input.Select(“[Data fine validità DURC] < #”+DataOdierna+"# Or [Data fine validità DURC] = ‘’ “).CopyToDataTable

Cheers @CamiCat

Thank you so much @Palaniyappan,

how to insert empty value in datatable datetime column?
image
this gives me error.
Colonna data non valorizzata: Exception has been thrown by the target of an invocation.
Thank you,
CAmi

we can mention as String.Empty
@CamiCat

were we facing any issues with this
Cheers @CamiCat

1 Like

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