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
  1. Home
  2. General Programming
  3. C#
  4. date format converter?

date format converter?

Scheduled Pinned Locked Moved C#
questioncsharp
3 Posts 3 Posters 0 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.
  • V Offline
    V Offline
    visiontec
    wrote on last edited by
    #1

    Hi there i an a newbie to c# how can i change the date to british date format?(dd-mm-yy) in my applications? VisionTec

    D H 2 Replies Last reply
    0
    • V visiontec

      Hi there i an a newbie to c# how can i change the date to british date format?(dd-mm-yy) in my applications? VisionTec

      D Offline
      D Offline
      Dmitriy Kostovetskiy
      wrote on last edited by
      #2

      Here is an example:

      MessageBox.Show(DateTime.Now.ToString("dd-MM-yy"));

      1 Reply Last reply
      0
      • V visiontec

        Hi there i an a newbie to c# how can i change the date to british date format?(dd-mm-yy) in my applications? VisionTec

        H Offline
        H Offline
        Heath Stewart
        wrote on last edited by
        #3

        A better way is to use an IFormatProvider for the British CultureInfo. For example, String.Format can take an IFormatProvider as the first parameter. This could be the CultureInfo.NumberFormat for the CultureInfo for the English (Britain) culture. By default, such methods uses the Thread.CurrentCulture but as I've mentioned you can override this behavior by passing an IFormatProvider. This is the correct way, instead of assuming and managing custom format specifiers like the previous post mentioned. For more information about localization and culture-specific formatting, see Developing World-Read Applications[^] in the .NET Framework SDK. With regard to your question, see Formatting Date and Time for a Specific Culture[^] under the previous topic.

        Microsoft MVP, Visual C# My Articles

        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