I have a DateTime value = 3/24/2011 6:25:29 PM saved I am public DateTime propertie LastChange how can I convert it to a German Datetime form? for example: 3/24/2011 18:25:29 ?
3/24/2011 6:25:29 PM
LastChange
3/24/2011 18:25:29
You can write
date.ToString(new CultureInfo("de-DE"))
Just use ToString and specify your custom format string as shown below
LastChange.ToString("M/dd/yyyy HH:mm:ss")
You can pass CultureInfo as IFormatProvider: http://msdn.microsoft.com/en-us/library/system.iformatprovider%28v=VS.90%29.aspx
Just replace your culture
System.DateTime now = System.DateTime.Now; System.Console.WriteLine(now); System.Globalization.CultureInfo culture = new System.Globalization.CultureInfo(1031); // de-DE System.Console.WriteLine(now.ToString(culture));
Source: https://habr.com/ru/post/1345081/More articles:Button Height on Chrome - htmlhttps://translate.googleusercontent.com/translate_c?depth=1&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/1345077/indexed-access-to-xelements-child-nodes&usg=ALkJrhj2h0_gJo3KSh63unJBLjb1ASJM8AT4MVC AsyncController - .netCannot call setNoRender () in viewRenderer in postDispatch () in Zend Framework controller plugin - phpAsyncController in MVC2 and T4MVC: can they work together? - asp.net-mvcMatlab: Variable names in a structure - structHow to write long IF more beautifully? - phpWhat is the best practice: global constant or #define? - c ++uiautomation - Clicking a user view does not work - iphoneIncrease body width to fit content - htmlAll Articles