How to extract the day of the week from a specific date and culture (language) in C#

1 Answer

0 votes
using System;
using System.Globalization;

class Program
{
    static void Main() {
        DateTime adate = new DateTime(2020, 8, 24);
        
        Console.WriteLine(adate.DayOfWeek);
        Console.WriteLine(adate.ToString("dddd"));
        Console.WriteLine(adate.ToString("dddd", new CultureInfo("fr-FR")));
        Console.WriteLine(adate.ToString("dddd", new CultureInfo("de-DE")));
        Console.WriteLine(adate.ToString("dddd", new CultureInfo("pl-PL")));
    }
}



/*
run:

Monday
Monday
lundi
Montag
poniedziaƂek

*/

 



answered Oct 8, 2020 by avibootz

Related questions

1 answer 182 views
4 answers 233 views
1 answer 152 views
3 answers 414 views
414 views asked Mar 25, 2015 by avibootz
...