Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C#
  4. DayOfWeek in other languages?

DayOfWeek in other languages?

Scheduled Pinned Locked Moved C#
csharpquestion
2 Posts 1 Posters 2 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    mistery22
    wrote on last edited by
    #1

    Hi, I was trying to make a language selection of the Day-name. When I get the date with DateTime.Now.DayOfWeek, is there a posibility in System.Globalization to return the name of a day in another language then the Windows language? Writing a switch case doesn't seems me to be the .NET way :). System.DateTime myDate = System.DateTime.Now; System.Globalization.CultureInfo ci = new CultureInfo("nl-BE"); myDate.DayOfWeek.ToString(ci); above code still returns the English Name, not the Dutch name. Thanks,

    M 1 Reply Last reply
    0
    • M mistery22

      Hi, I was trying to make a language selection of the Day-name. When I get the date with DateTime.Now.DayOfWeek, is there a posibility in System.Globalization to return the name of a day in another language then the Windows language? Writing a switch case doesn't seems me to be the .NET way :). System.DateTime myDate = System.DateTime.Now; System.Globalization.CultureInfo ci = new CultureInfo("nl-BE"); myDate.DayOfWeek.ToString(ci); above code still returns the English Name, not the Dutch name. Thanks,

      M Offline
      M Offline
      mistery22
      wrote on last edited by
      #2

      I found it by myself :) It seems that .DayOfWeek only returns the english name. When you use to formatted string DateTime.Now.ToString("dddd") it returns the day with the name in the language from the windows settings (not the windows language itsels). To force it to another language you can use. System.Globalization.CultureInfo ci = new CultureInfo("fr-BE"); DateTime.Now.ToString("dddd", ci) And it will return the day of the week in the language specified in the CultureInfo. :cool: So I was right to suppose a switch structure was not he .Net way.

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups