How to retrieve current day emails if the date of email coming as Thu, 29 Jul 2021 01:13:16 -0700?

Hi Experts,

Is their any way to get current day emails if the date of email is coming as Thu, 29 Jul 2021 01:13:16 -0700 ?

I have tried below method but it is giving error as “System exception at initialization: String was not recognized as a valid DateTime. at Source: mscorlib”

Query Used -
GetMails.Where(Function(x) DateTime.ParseExact(x.Headers(“Date”), “ddd, dd MMM yyyy HH:mm:ss”,Nothing).Date.Equals(DateTime.Now.Date)).ToList

Need you suggestions.

Thanks

1 Like

Hi

Can you try "ddd, dd MMM yyyy HH:mm:ss K" instead of “ddd, dd MMM yyyy HH:mm:ss”?

Regards,

It’s working now.

Thanks :slightly_smiling_face:

1 Like

What this K mean ?

Hi,

Can you check the following document? (K Specifier section)

Regards,

1 Like

hi @ermanoj3101 - I always keep the below reference handy for date time formats…very useful…

1 Like

Thanks @prasath17 , this is very useful.

1 Like

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