How can i change system time formate through codding RRS feed

  • Question

  • I want to change system time formate but i have no idea to where from i should change it.
    Plz help me out!.
    Tuesday, January 22, 2008 4:48 AM


All replies

  • The system always store the date info in mm/dd/yyyym you can only view the date in different way.

    You can use ToString function for this, e.e

    string changedDate = DateTime.Now.ToString("dd/MM/yyyy");

    // 22/Jan/08 displayed like that

    changedDate = DateTime.Now.ToString("dd/MMM/yy");

    // 22/Jan/08 displayed like that

    Tuesday, January 22, 2008 5:35 AM
  • Depends really, it will change if you use the CultureInfo class, when you change the localization settings on the machine.


    If you just wanted to change the format once, then you can use something along the lines:


    DateTime aQuickDate = DateTime.Now;


    System.Diagnostics.WriteLine(aQuickDate.ToString("hh:MMTongue Tieds"));


    Also the ToString can take values that indicate to use the short or long time formats (and dates)


    You can also create an IFormatProvider object I think, from memory, to do a similar sort of thing for you.


    Take a look at MSDN to find the correct format string to use...


    Good luck,


    Martin Platt.

    Tuesday, January 22, 2008 5:36 AM
  • But there is a little problem Ssytem.Diagnostics has not such type of metthod WriteLine or any other mettod.
    Then how can i will pass my date formate to system.
    Thanks for replying.
    Tuesday, January 22, 2008 6:41 AM
  • Then how can i will pass my date formate to system.



    I think you want to chage the system time format, that we generaly do from control panel, but you want to do using C#


    hope this link will do for you



    Tuesday, January 22, 2008 6:49 AM
  • Well Well I am not going to set the time of the system.
    I want to chang the date formate of the system.
    I visit your link but there is only setting system time through API.
    Thats not my problem.
    Tuesday, January 22, 2008 9:12 AM



    You can use the Windows API SetLocaleInfo to do this.


    For detail information, you can refer to



    Hope this helps!


    Wednesday, January 23, 2008 6:52 AM