HOW DO I GET THE DAY WITH RESPECT TO DATE?

Hi Team,

I was wondering how to get a DAY with respect to the date that I give.

For example:-

  1. Today.DayOfWeek

This will give me todays DAY.

But how about giving in the date (15th Jan 2020) and I get “Wednesday”
OR

giving in the date as (6th Jan 2020) and I get “Monday”

I hope you got my points.

Thanks and Regards,
@hacky

1 Like

Hi @hacky,

We can’t get the date string with day suffix, instead you can give the dd MMM yyyy format.

DateString = "15 Jan 2020"

DateTimeVar = DateTime.ParseExact(DateString,"dd MMM yyyy",System.Globalization.CultureInfo.InvariantCulture)

Then you can get the Day Of Week by DateTimeVar.DayOfWeek.ToString

Find the sample file attached, Sample.xaml (4.5 KB)

2 Likes

@kuppu_samy

Excellently done!!

2 Likes

Hi,

The simplest method is:
CDate(“15 Jan 2020”).DayOfWeek

3 Likes

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