C# DateTime'den Türkçe gün adını almak [CultureInfo]

R

ravex

Ultra Member
Joined
Jul 30, 2019
Messages
661
Reaction score
356
Location
Turkey
Selamlar,

Bu dersin içeriği;
Belirli bir tarihteki günün adını almakBelirli bir tarihteki günün Türkçe veya başka dillerdeki adını almak
1 - Belirli bir tarihteki günün adını almak
2-Belirli bir tarihteki günün Türkçe veya başka dillerdeki adını almak
1 - Belirli bir tarihteki günün adını almak

C#:
string _GunuVer_1 = DateTime.Now.ToString("dddd");
string _GunuVer_2 = DateTime.Now.DayOfWeek;
string _GunuVer_3 = DateTime.Parse("2017-09-09").DayOfWeek;
string _GunuVer_3 = CultureInfo.CurrentCulture.DateTimeFormat.DayNames[(int)DateTime.Now.DayOfWeek];
Bu kod ile örneğin 02.02.2020tarihindeki günün haftanın hangi günü olduğunu verir. Gün adları bu kodlar ile kullanıcının dilinde verilir.
2 - Belirli bir tarihteki günün Türkçe veya başka dillerdeki adını almak

C#:
string _GunuVer_TR = CultureInfo.GetCultureInfo("tr-TR").DateTimeFormat.DayNames[(int)DateTime.Now.DayOfWeek];
string _GunuVer_DE = CultureInfo.GetCultureInfo("de-DE").DateTimeFormat.DayNames[(int)DateTime.Now.DayOfWeek];





 
SPAM IS FORBIDDEN!
  • SPAMMERS ARE BANNED FROM THE FORUM AND CANNOT USE ANY OF THE CHEATS
  • For example: thanks, thx, very good, asdqwe, working, ty and so on!
  • For example: Writing the same message over and over. thanks, thx and so on!
  • Copying and copying someone else's message is prohibited.
  • It is forbidden to send messages to increase the number of comments on threads that you have no knowledge of.
  • Write your own opinion when commenting!
  • If you see spam message, please let us know with the REPORT button!

Tema düzenleyici

Top Bottom