How to filter And get row which celebrate Birthday today by the Date of Birth

31.08.2021_22.13.37_REC
hi Team,
i m Having set of birthdays i need to get all the row for today with out consider the year
like above is Their any way to get this Results

Thank you
Tharusha

Hi @Tharusha_Fernando

Please check this article

1 Like

Could you please share sample sheet(After masking/removing sensitive info)?

2 Likes

Filterdatatable.xlsx (45.2 KB)

Hi @prasath17

use this as a sample

Thank you

@Tharusha_Fernando
may we ask you to run following in immediat box and share the result with us:
YourDataTableVar.Rows(5).ItemArray

In general we can try with following logic:
CDate(“05-06-2017”).toString(“ddMM”).Equals(now.toString(“ddMM”))

Just need to adopt the Date Conversion based on the screenshot from immediate Box run
As we can expect that no rows will be found, we will handle result defensive:

Assign:
LeftSide: Result | DataType: List(Of DataRow)
Right side:

(From d In YourDataTableVar.AsEnumerable
Where Not (isNothing(d("regDate" )) OrElse String.IsNullOrEmpty(d("regDate").toString))
Where CDate(d("regDate").toString.Trim).toString("ddMM").Equals(Now.ToString("ddMM"))
Select r = d).toList

Based on Result.Count > 0
then: dtFiltered = Result.CopyToDataTAble
else: dtFiltered = YourDataTableVar.Clone

2 Likes

@Tharusha_Fernando - Since you have 1000+ rows in the excel , I am providing the LINQ solution…

  1. Read Range your sheet and call the output as dt

  2. Assign

     (From r In dt.AsEnumerable
     Where DateTime.parse(r("regDate").tostring).Month = Now.Month And  
     DateTime.parse(r("regDate").tostring).day = now.Day
     Select r).CopyToDataTable
    

Note: My date is 8/31 today so it is listed 8/31 bdays if your country date is 9/1 already it will show the 9/1 birthdays…

Hope this helps…

2 Likes

It woks @prasath17 Thank you Guys

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